Interface: BitmapFontOptions
Defined in: node_modules/pixi.js/lib/scene/text-bitmap/BitmapFont.d.ts:50
Options for creating a BitmapFont. Used when loading or creating bitmap fonts from existing textures and data.
Example
import { BitmapFont, Texture } from 'pixi.js';
// Create a bitmap font from loaded textures and data
const font = new BitmapFont({
// Font data containing character metrics and layout info
data: {
pages: [{ id: 0, file: 'font.png' }],
chars: {
'A': {
id: 65,
page: 0,
x: 0,
y: 0,
width: 32,
height: 32,
xOffset: 0,
yOffset: 0,
xAdvance: 32,
letter: 'A'
}
// ... other characters
},
fontSize: 32,
lineHeight: 36,
baseLineOffset: 26,
fontFamily: 'MyFont',
// Optional distance field info for MSDF/SDF fonts
distanceField: {
type: 'msdf',
range: 4
}
},
// Array of textures containing the font glyphs
textures: [
Texture.from('font.png')
]
});
Standard
Properties
data
> data: BitmapFontData
Defined in: node_modules/pixi.js/lib/scene/text-bitmap/BitmapFont.d.ts:56
The bitmap font data containing character metrics, layout information, and font properties. This includes character positions, dimensions, kerning data, and general font settings.
textures
> textures: Texture<TextureSource<any>>[]
Defined in: node_modules/pixi.js/lib/scene/text-bitmap/BitmapFont.d.ts:62
Array of textures containing the font glyphs. Each texture corresponds to a page in the font data. For simple fonts this is typically just one texture, but complex fonts may split glyphs across multiple textures.