BitmapFont

class BitmapFont(    val fontSize: Float,     val lineHeight: Float,     val base: Float,     val capHeight: Float,     val padding: FontMetrics.Padding,     val textures: List<Texture>,     val glyphs: Map<Int, BitmapFont.Glyph>,     val kernings: Map<Int, Kerning>,     val pages: Int = 1) : Font

A Font that handles rendering of bitmap fonts using the BMFont text format.

The text is drawn using a SpriteBatch. The text can also be cached in a FontCache to render static text without having to compute the geometry of each glyph every frame. The BitmapFontCache can be used specifically for this class.

The textures required for a BitmapFont are managed and may be disposed by directly calling the dispose method on the BitmapFont object.

Author

Colt Daily

Constructors

Link copied to clipboard
fun BitmapFont(    fontSize: Float,     lineHeight: Float,     base: Float,     capHeight: Float,     padding: FontMetrics.Padding,     textures: List<Texture>,     glyphs: Map<Int, BitmapFont.Glyph>,     kernings: Map<Int, Kerning>,     pages: Int = 1)

Types

Link copied to clipboard
data class Glyph(    val fontSize: Float,     val id: Int,     val slice: TextureSlice,     val xoffset: Int,     val yoffset: Int,     val xadvance: Int,     val width: Int,     val height: Int,     val page: Int)

Functions

Link copied to clipboard
open override fun dispose()
Link copied to clipboard
fun draw(    batch: Batch,     text: CharSequence,     x: Float,     y: Float,     rotation: Angle = Angle.ZERO,     color: Color = Color.WHITE,     targetWidth: Float = 0.0f,     align: HAlign = HAlign.LEFT,     wrap: Boolean = false)

Draws a string of text.

Link copied to clipboard
open operator fun get(char: Char): GlyphMetrics?
open operator fun get(code: Int): GlyphMetrics?
Link copied to clipboard
open override fun getKerning(first: Int, second: Int): Kerning?

Fetches the Kerning between two codepoints.

open fun getKerning(first: Char, second: Char): Kerning?

Fetches the Kerning between two characters.

Link copied to clipboard
open fun getKerningAmount(scale: Float, first: Char, second: Char): Float

Fetches the Kerning.amount between two characters.

open fun getKerningAmount(scale: Float, first: Int, second: Int): Float

Fetches the Kerning.amount between two codepoint.

Link copied to clipboard
open fun isWhitespace(char: Char): Boolean

Determines if the character is considered whitespace.

Link copied to clipboard
open fun isWrapChar(char: Char): Boolean

Determines if the character is considered a "wrap" character.

Properties

Link copied to clipboard
val base: Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val glyphMetrics: Map<Int, GlyphMetrics>

The glyph metrics supported by this Font.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val metrics: FontMetrics

The font metrics of this Font

Link copied to clipboard
var name: String? = null

The name of the font or null.

Link copied to clipboard
Link copied to clipboard
val pages: Int = 1
Link copied to clipboard
Link copied to clipboard
open override var wrapChars: CharSequence

Additional characters besides whitespace where text is wrapped. Eg: a hyphen (-).