loadBitmapFont(name: string | null, src: string, gridW: number, gridH: number, opt?: LoadBitmapFontOpt): Asset<BitmapFontData>

Load a bitmap font into asset manager, with name and resource url and information on the layout of the bitmap.

paramname- The asset name.

paramsrc- The resource url.

paramgridW- The width of each character on the bitmap.

paramgridH- The height of each character on the bitmap.

paramopt- The options for the bitmap font.

// load a bitmap font called "04b03", with bitmap "fonts/04b03.png"
// each character on bitmap has a size of (6, 8), and contains default ASCII_CHARS
loadBitmapFont("04b03", "fonts/04b03.png", 6, 8);

// load a font with custom characters
loadBitmapFont("myfont", "myfont.png", 6, 8, { chars: "☺☻♥♦♣♠" });

returnsThe asset data.

sincev3000.0

kaplay logo

Misc

Layer