Skip to main content
Version: Phaser v4.0.0

Phaser.GameObjects.RetroFont

Scope: static

Source: src/gameobjects/bitmaptext/RetroFont.js#L10
Since: 3.6.0

Static functions

Parse

<static> Parse(scene, config)

Description:

Parses a Retro Font configuration object and builds a BitmapFontData structure that can be passed to the BitmapText constructor to render text using a fixed-width retro font.

A retro font is a texture containing a uniform grid of characters, each cell being the same width and height. This function reads the configuration, looks up the source texture frame, then iterates over every character defined in config.chars, calculating its pixel position and normalised UV coordinates within the texture. The resulting data object maps each character code to its own glyph entry and is suitable for registering in the Bitmap Font cache.

If config.chars is an empty string the function returns undefined without producing any data.

Parameters:

nametypeoptionaldescription
scenePhaser.SceneNoA reference to the Phaser Scene.
configPhaser.Types.GameObjects.BitmapText.RetroFontConfigNoThe font configuration object.

Returns: Phaser.Types.GameObjects.BitmapText.BitmapFontData - A parsed Bitmap Font data entry containing per-character glyph data and UV coordinates, ready for the Bitmap Font cache.

Source: src/gameobjects/bitmaptext/ParseRetroFont.js#L9
Since: 3.0.0


Static functions

TEXT_SET1

TEXT_SET1: string

Description:

A RetroFont character set containing the full printable ASCII range (space through tilde), including both uppercase and lowercase letters, digits, and symbols.

Text Set 1 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Source: src/gameobjects/bitmaptext/const.js#L9
Since: 3.6.0


TEXT_SET10

TEXT_SET10: string

Description:

A RetroFont character set containing only the 26 uppercase letters of the alphabet. Use this for font sprite sheets that contain no digits, spaces, or punctuation glyphs.

Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ

Source: src/gameobjects/bitmaptext/const.js#L118
Since: 3.6.0


TEXT_SET11

TEXT_SET11: string

Description:

A RetroFont character set containing uppercase letters, a broad selection of punctuation symbols including quotes and arithmetic operators, followed by digits.

Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789

Source: src/gameobjects/bitmaptext/const.js#L130
Since: 3.6.0


TEXT_SET2

TEXT_SET2: string

Description:

A RetroFont character set containing printable ASCII characters from space through uppercase Z, including digits and common symbols but no lowercase letters.

Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ

Source: src/gameobjects/bitmaptext/const.js#L21
Since: 3.6.0


TEXT_SET3

TEXT_SET3: string

Description:

A RetroFont character set containing uppercase letters followed by digits, with a trailing space.

Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Source: src/gameobjects/bitmaptext/const.js#L33
Since: 3.6.0


TEXT_SET4

TEXT_SET4: string

Description:

A RetroFont character set containing uppercase letters, a space, then digits. The space character appears between the alphabet and the digits rather than at the end.

Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789

Source: src/gameobjects/bitmaptext/const.js#L44
Since: 3.6.0


TEXT_SET5

TEXT_SET5: string

Description:

A RetroFont character set containing uppercase letters followed by common punctuation symbols and digits. Useful for fonts that include sentence punctuation such as periods, commas, parentheses, and question marks.

Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789

Source: src/gameobjects/bitmaptext/const.js#L56
Since: 3.6.0


TEXT_SET6

TEXT_SET6: string

Description:

A RetroFont character set containing uppercase letters, digits, and a range of punctuation symbols including quotes, parentheses, and a trailing space.

Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.`

Source: src/gameobjects/bitmaptext/const.js#L69
Since: 3.6.0


TEXT_SET7

TEXT_SET7: string

Description:

A RetroFont character set where the characters are arranged in a non-sequential, interleaved order. This matches the sprite layout of certain retro font sheets where every fifth character continues the sequence (A, G, M, S, Y, then B, H, N, T, Z, etc.).

Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39

Source: src/gameobjects/bitmaptext/const.js#L81
Since: 3.6.0


TEXT_SET8

TEXT_SET8: string

Description:

A RetroFont character set where digits come first, followed by a space, period, and then uppercase letters. Use this when the font sprite sheet places numerals before the alphabet.

Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ

Source: src/gameobjects/bitmaptext/const.js#L94
Since: 3.6.0


TEXT_SET9

TEXT_SET9: string

Description:

A RetroFont character set containing uppercase letters, parentheses and a hyphen, digits, and common sentence punctuation including quotes and an exclamation mark.

Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?!

Source: src/gameobjects/bitmaptext/const.js#L106
Since: 3.6.0