Skip to content
samme edited this page Nov 12, 2022 · 7 revisions

There are different kinds.

Bitmap text

Bitmap text is drawn from a bitmap texture (or a frame thereof) and font data (character set and coordinates).

From an image and font data

The “hyperdrive” bitmap font image

This is the usual way. The data file is XML (either fnt or xml extension).

this.load.bitmapFont('desyrel', 'assets/fonts/bitmap/desyrel.png', 'assets/fonts/bitmap/desyrel.xml');

From an atlas and font data

Load the image and XML data separately, then call ParseFromAtlas() to create the font.

Retro font

The “knighthawks” retro font image

Load the image and then call RetroFont.Parse() with the font data.

Static

this.add.bitmapText(x, y, font, text, size, align)

Static bitmap text lacks the "dynamic" rendering features (see below).

Dynamic

this.add.dynamicBitmapText(x, y, font, text, size)

Dynamic bitmap text has per-character display effects (via callbacks) and scrolling effects (via scrollX and scrollY).

Text

this.add.text(x, y, text, style)

Text game objects use Canvas 2d text on an internal canvas. They're quite flexible but more resource-expensive (especially in WebGL mode).

Clone this wiki locally