Skip to content

installBitmapFont

installBitmapFont(source, opts): Promise<string>

Defined in: packages/renderer/src/assets.ts:398

Load a .ttf/.woff and bake a bitmap glyph atlas from it via Pixi v8’s BitmapFont.install. Returns the registered font name, ready to hand to style.fontFamily (with bitmap: true) on UIText / TextComponent. Pair with uninstallBitmapFont to free the atlas when it’s no longer used.

const font = await installBitmapFont("fonts/PressStart2P.ttf", {
name: "PressStart",
size: 16,
});
entity.add(
new TextComponent({ text: "READY", bitmap: true, style: { fontFamily: font } }),
);

string | AssetHandle<unknown>

InstallBitmapFontOptions

Promise<string>