BitmapFont

class BitmapFont(val identifier: FontIdentifier, val texture: Texture, val glyphDataMap: Map<Char, BitmapGlyphData?>, val height: Float, val ascent: Float, val descent: Float, val top: Float, val bottom: Float, val italicInverseSlope: Float) : Font

Constructors

Link copied to clipboard
constructor(identifier: FontIdentifier, texture: Texture, glyphDataMap: Map<Char, BitmapGlyphData?>, height: Float, ascent: Float, descent: Float, top: Float, bottom: Float, italicInverseSlope: Float)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val ascent: Float

The font ascent is the distance from the font's baseline to the top of most alphanumeric characters. NOTE. I've read that ascent is sometimes defined as the position of the top of the glyph relative to the baseline, and is therefore negative. ascent is always positive.

Link copied to clipboard
open override val bottom: Float

The maximum descent of the Font. No character should extend further below the font's baseline than this. "Badly behaved" fonts do not adhere to this though. This field is taken from the font's meta-data, not from the shape of the glyph itself, and these can very well differ :-(

Link copied to clipboard
open override val descent: Float

The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters with descenders.

Link copied to clipboard
open override val fixedWidth: Float

The width of all glyphs (if this is a fixed width font, otherwise 0.

Link copied to clipboard
Link copied to clipboard
open override val height: Float

This is the distance between the baseline of adjacent lines of text. It is the sum of the leading + ascent + descent.

Link copied to clipboard
open override val identifier: FontIdentifier
Link copied to clipboard
open override val italicInverseSlope: Float

The inverse slope of the caret which best matches the posture of this Font.

Link copied to clipboard
open override val maxWidthOfDigit: Float

The width of the widest digit as well as "." and "-" Suitable for working out prefWidths of TextFields which contain only numbers.

Link copied to clipboard
Link copied to clipboard
open override val top: Float

The maximum ascent of the Font. No character should extend further above the font's baseline than this. "Badly behaved" fonts to not adhere to this though. This field is taken from the font's meta-data, not from the shape of the glyph itself, and these can very well differ :-(

Functions

Link copied to clipboard
open override fun caretPosition(text: CharSequence, x: Float, indentationColumns: Int): Int

Calculate the carat position (0..text.length inclusive) for a given x in pixels for a given text.

Link copied to clipboard
open override fun drawTopLeft(text: CharSequence, color: Color, x: Float, y: Float, indentationColumns: Int, startColumn: Int, modelMatrix: Matrix?)

Draws text where the top left of the first glyph is at x, y

Link copied to clipboard
open override fun hasGlyph(c: Char): Boolean
Link copied to clipboard
open override fun image(): Texture

For bitmap based fonts, returns the texture, otherwise null. I use this for debugging only, and probably has no other value.

Link copied to clipboard
open override fun widthOf(text: CharSequence, indentationColumns: Int, startColumn: Int): Float

Calculates the width of text in pixels. indentationColumns and startColumn are required to correctly work out the width of a tab character.