BitmapFontData

ceramic.BitmapFontData (Class)

Complete data structure containing all information about a bitmap font.

BitmapFontData stores everything needed to render text with a bitmap font: character definitions, texture page references, kerning pairs, and metrics. This data is typically loaded from font definition files (like BMFont format) and used to construct a BitmapFont instance.

The data includes:

  • Font metadata (face name, sizes)
  • Character definitions with texture coordinates and metrics
  • Texture page information for multi-page fonts
  • Kerning data for improved character spacing
  • Optional distance field data for high-quality scaling
var fontData:BitmapFontData = {
    face: "Arial",
    pointSize: 32,
    baseSize: 32,
    lineHeight: 40,
    chars: new IntMap(),
    pages: [{id: 0, file: "arial_0.png"}],
    kernings: new IntMap()
};
See: BitmapFont The font class that uses this data, BitmapFontParser For loading font data from files

Instance Members

face: String

The name of the font face (e.g., "Arial", "Helvetica"). This identifies the typeface family.


path: String

Path to the directory containing the font files. Used to resolve relative paths for texture pages. Can be null or empty for fonts in the root directory.


pointSize: Float

Font size in points at which the glyphs were rendered. This is the reference size for all metrics. When rendering at different sizes, metrics are scaled proportionally.


baseSize: Float

Base size of the font in pixels. Usually matches pointSize but may differ depending on the tool used to generate the bitmap font.


Map of all characters in the font, indexed by Unicode code point. Each character contains texture coordinates, size, and positioning data. Missing characters will not be present in the map.


charCount: Int

Total number of characters defined in this font. This count includes all glyphs across all texture pages. Useful for validation and statistics.


Optional distance field data for SDF (Signed Distance Field) fonts. When present, indicates this is an MSDF font that can be scaled without quality loss. Null for regular bitmap fonts.


Array of texture pages containing the font glyphs. Large fonts may span multiple textures to fit all characters. Pages are referenced by index in BitmapFontCharacter.page.


lineHeight: Float

Recommended line height in pixels. This is the vertical distance between baselines of consecutive lines of text. Includes ascent, descent, and line gap.


kernings: IntMap<IntFloatMap>

Kerning information for character pairs.

Kerning adjusts the spacing between specific character pairs for better visual appearance (e.g., "AV" vs "AA").

Structure: kernings[firstChar][secondChar] = adjustment

  • First key: Unicode code point of the first character
  • Second key: Unicode code point of the second character
  • Value: Horizontal adjustment in pixels (usually negative)
var kernValue = kernings.get(65)?.get(86); // Kerning for "AV"
if (kernValue != null) cursorX += kernValue;

new(face: String, path: String, pointSize: Float, baseSize: Float, chars: IntMap<BitmapFontCharacter>, charCount: Int, distanceField: Null<BitmapFontDistanceFieldData>, pages: Array<BitmapFontDataPage>, lineHeight: Float, kernings: IntMap<IntFloatMap>): Void
Name Type Description
face String * The name of the font face (e.g., "Arial", "Helvetica"). This identifies the typeface family.
path String * Path to the directory containing the font files. Used to resolve relative paths for texture pages. Can be null or empty for fonts in the root directory.
pointSize Float * Font size in points at which the glyphs were rendered. This is the reference size for all metrics. When rendering at different sizes, metrics are scaled proportionally.
baseSize Float * Base size of the font in pixels. Usually matches pointSize but may differ depending on the tool used to generate the bitmap font.
chars IntMap<BitmapFontCharacter> * Map of all characters in the font, indexed by Unicode code point. Each character contains texture coordinates, size, and positioning data. Missing characters will not be present in the map.
charCount Int * Total number of characters defined in this font. This count includes all glyphs across all texture pages. Useful for validation and statistics.
distanceField Null<BitmapFontDistanceFieldData> * Optional distance field data for SDF (Signed Distance Field) fonts. When present, indicates this is an MSDF font that can be scaled without quality loss. Null for regular bitmap fonts.
pages Array<BitmapFontDataPage> * Array of texture pages containing the font glyphs. Large fonts may span multiple textures to fit all characters. Pages are referenced by index in BitmapFontCharacter.page.
lineHeight Float * Recommended line height in pixels. This is the vertical distance between baselines of consecutive lines of text. Includes ascent, descent, and line gap.
kernings IntMap<IntFloatMap> * Kerning information for character pairs. * Kerning adjusts the spacing between specific character pairs for better visual appearance (e.g., "AV" vs "AA"). * Structure: kernings[firstChar][secondChar] = adjustment - First key: Unicode code point of the first character - Second key: Unicode code point of the second character - Value: Horizontal adjustment in pixels (usually negative) * haxe var kernValue = kernings.get(65)?.get(86); // Kerning for "AV" if (kernValue != null) cursorX += kernValue;

Metadata

Name Parameters
:structInit -