Optional
url: stringshould the fill for this font be applied as a tint to the text.
Readonly
baseThe offset of the font face from the baseline.
Readonly
baseThe size of the font face in pixels.
Readonly
charsThe map of characters by character code.
Readonly
distanceThe range and type of the distance field for this font.
Range of the distance field in pixels
Type of distance field
Readonly
fontThe name of the font face
Readonly
fontThe metrics of the font face.
Readonly
lineThe line-height of the font face in pixels.
Readonly
pagesThe map of base page textures (i.e., sheets of glyphs).
Optional
urlThe 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.
Static
installGenerates 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'
}
});
Static
uninstallUninstalls 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