Function

loadBitmapFontFromSprite

(sprite: string, chars: string): Asset<BitmapFontData>

Define the frames of an existing sprite as characters that can be used as a font. This was primarily intended for use with loadSpriteAtlas because the sprite in question usually isn't the whole image and so can't be also passed to loadBitmapFont as its own font. This waits for the sprite to load before doing anything, but if the sprite doesn't load, the game will transition to the error screen after a timeout (which is set by ).

param sprite- The ID of the sprite to use as a font. Must already have frames defined

param chars- The characters that correspond to each of the frames in the sprite. You can't use space or newline here because those are hard-coded to special behaviors in the text layout code.

returns The generated font data.

group Assets

subgroup Fonts

see

kaplay logo

Components