Optionalurl: stringshould the fill for this font be applied as a tint to the text.
ReadonlybaseThe offset of the font face from the baseline.
ReadonlybaseThe size of the font face in pixels.
ReadonlycharsThe map of characters by character code.
ReadonlydistanceThe range and type of the distance field for this font.
Range of the distance field in pixels
Type of distance field
ReadonlyfontThe name of the font face
ReadonlyfontThe metrics of the font face.
ReadonlylineThe line-height of the font face in pixels.
ReadonlypagesThe map of base page textures (i.e., sheets of glyphs).
OptionalurlThe URL from which the font was loaded, if applicable. This is useful for tracking font sources and reloading.
The map of base page textures (i.e., sheets of glyphs).
Destroys the BitmapFont object.
StaticinstallGenerates and installs a bitmap font with the specified options. The font will be cached and available for use in BitmapText objects.
Setup options for font generation
Installed font instance
// Install a basic font
BitmapFont.install({
name: 'Title',
style: {
fontFamily: 'Arial',
fontSize: 32,
fill: '#ffffff'
}
});
// Install with advanced options
BitmapFont.install({
name: 'Custom',
style: {
fontFamily: 'Arial',
fontSize: 24,
fill: '#00ff00',
stroke: { color: '#000000', width: 2 }
},
chars: [['a', 'z'], ['A', 'Z'], ['0', '9']],
resolution: 2,
padding: 4,
textureStyle: {
scaleMode: 'nearest'
}
});
StaticuninstallUninstalls a bitmap font from the cache. This frees up memory and resources associated with the font.
The name of the bitmap font to uninstall
A BitmapFont object represents a particular font face, size, and style. This class handles both pre-loaded bitmap fonts and dynamically generated ones.
Example