Namespace: BitmapText

Phaser.Types.GameObjects. BitmapText

Type Definitions


BitmapFontCharacterData

The font data for an individual character of a Bitmap Font.

Describes the character's position, size, offset and kerning.

Type:
  • object
Properties:
Name Type Description
x number

The x position of the character.

y number

The y position of the character.

width number

The width of the character.

height number

The height of the character.

centerX number

The center x position of the character.

centerY number

The center y position of the character.

xOffset number

The x offset of the character.

yOffset number

The y offset of the character.

data object

Extra data for the character.

kerning Object.<number>

Kerning values, keyed by character code.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapFontCharacterData.js (Line 1)

BitmapFontData

Bitmap Font data that can be used by a BitmapText Game Object.

Type:
  • object
Properties:
Name Type Description
font string

The name of the font.

size number

The size of the font.

lineHeight number

The line height of the font.

retroFont boolean

Whether this font is a retro font (monospace).

chars Object.<number, Phaser.Types.GameObjects.BitmapText.BitmapFontCharacterData>

The character data of the font, keyed by character code. Each character datum includes a position, size, offset and more.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapFontData.js (Line 1)

BitmapTextConfig

Type:
  • object
Properties:
Name Type Argument Default Description
font string <optional>
''

The key of the font to use from the BitmapFont cache.

text string <optional>
''

The string, or array of strings, to be set as the content of this Bitmap Text.

size number | false <optional>
false

The font size to set.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapTextConfig.js (Line 1)

BitmapTextSize

Type:
  • object
Properties:
Name Type Description
global Phaser.Types.GameObjects.BitmapText.GlobalBitmapTextSize

The position and size of the BitmapText, taking into account the position and scale of the Game Object.

local Phaser.Types.GameObjects.BitmapText.LocalBitmapTextSize

The position and size of the BitmapText, taking just the font size into account.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapTextSize.js (Line 1)

DisplayCallback(display)

Parameters:
Name Type Description
display Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig

Settings of the character that is about to be rendered.

Source: src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js (Line 16)
Returns:

Altered position, scale and rotation values for the character that is about to be rendered.

Type
Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig

DisplayCallbackConfig

Type:
  • object
Properties:
Name Type Description
parent Phaser.GameObjects.DynamicBitmapText

The Dynamic Bitmap Text object that owns this character being rendered.

tint Phaser.Types.GameObjects.BitmapText.TintConfig

The tint of the character being rendered. Always zero in Canvas.

index number

The index of the character being rendered.

charCode number

The character code of the character being rendered.

x number

The x position of the character being rendered.

y number

The y position of the character being rendered.

scale number

The scale of the character being rendered.

rotation number

The rotation of the character being rendered.

data any

Custom data stored with the character being rendered.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js (Line 1)

GlobalBitmapTextSize

The position and size of the Bitmap Text in global space, taking into account the Game Object's scale and world position.

Type:
  • object
Properties:
Name Type Description
x number

The x position of the BitmapText, taking into account the x position and scale of the Game Object.

y number

The y position of the BitmapText, taking into account the y position and scale of the Game Object.

width number

The width of the BitmapText, taking into account the x scale of the Game Object.

height number

The height of the BitmapText, taking into account the y scale of the Game Object.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/GlobalBitmapTextSize.js (Line 1)

JSONBitmapText

Type:
  • object
Properties:
Name Type Description
font string

The name of the font.

text string

The text that this Bitmap Text displays.

fontSize number

The size of the font.

letterSpacing number

Adds / Removes spacing between characters.

align integer

The alignment of the text in a multi-line BitmapText object.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/JSONBitmapText.js (Line 1)

LocalBitmapTextSize

The position and size of the Bitmap Text in local space, taking just the font size into account.

Type:
  • object
Properties:
Name Type Description
x number

The x position of the BitmapText.

y number

The y position of the BitmapText.

width number

The width of the BitmapText.

height number

The height of the BitmapText.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/LocalBitmapTextSize.js (Line 1)

RetroFontConfig

Type:
  • object
Properties:
Name Type Description
image string

The key of the image containing the font.

offset.x number

If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

offset.y number

If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

width number

The width of each character in the font set.

height number

The height of each character in the font set.

chars string

The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.

charsPerRow number

The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth.

spacing.x number

If the characters in the font set have horizontal spacing between them set the required amount here.

spacing.y number

If the characters in the font set have vertical spacing between them set the required amount here.

lineSpacing number

The amount of vertical space to add to the line height of the font.

Since: 3.6.0
Source: src/gameobjects/bitmaptext/typedefs/RetroFontConfig.js (Line 1)

TintConfig

Type:
  • object
Properties:
Name Type Description
topLeft number

The top left tint value. Always zero in canvas.

topRight number

The top right tint value. Always zero in canvas.

bottomLeft number

The bottom left tint value. Always zero in canvas.

bottomRight number

The bottom right tint value. Always zero in canvas.

Since: 3.0.0
Source: src/gameobjects/bitmaptext/typedefs/TintConfig.js (Line 1)