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.

As of version 3.50 it also includes the WebGL texture uv data.

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.

u0 number

WebGL texture u0.

v0 number

WebGL texture v0.

u1 number

WebGL texture u1.

v1 number

WebGL texture v1.

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)

BitmapTextCharacter

A single entry from the BitmapTextSize characters array.

The position and dimensions take the font size into account, but are not translated into the local space of the Game Object itself.

Type:
  • object
Properties:
Name Type Description
i number

The index of this character within the BitmapText text string.

char string

The character.

code number

The character code of the character.

x number

The x position of the character in the BitmapText.

y number

The y position of the character in the BitmapText.

w number

The width of the character.

h number

The height of the character.

t number

The top of the line this character is on.

r number

The right-most point of this character, including xAdvance.

b number

The bottom of the line this character is on.

line number

The line number the character appears on.

glyph Phaser.Types.GameObjects.BitmapText.BitmapFontCharacterData

Reference to the glyph object this character is using.

Since: 3.50.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapTextCharacter.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)

BitmapTextLines

Details about the line data in the BitmapTextSize object.

Type:
  • object
Properties:
Name Type Description
shortest number

The width of the shortest line of text.

longest number

The width of the longest line of text.

height number

The height of a line of text.

lengths Array.<number>

An array where each entry contains the length of that line of text.

Since: 3.50.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapTextLines.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.

lines Phaser.Types.GameObjects.BitmapText.BitmapTextLines

Data about the lines of text within the BitmapText.

characters Array.<Phaser.Types.GameObjects.BitmapText.BitmapTextCharacter>

An array containing per-character data. Only populated if includeChars is true in the getTextBounds call.

words Array.<Phaser.Types.GameObjects.BitmapText.BitmapTextWord>

An array containing the word data from the BitmapText.

scale number

The scale of the BitmapText font being rendered vs. font size in the text data.

scaleX number

The scale X value of the BitmapText.

scaleY number

The scale Y value of the BitmapText.

wrappedText string

The wrapped text, if wrapping enabled and required.

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

BitmapTextWord

Details about a single world entry in the BitmapTextSize object words array.

Type:
  • object
Properties:
Name Type Description
x number

The x position of the word in the BitmapText.

y number

The y position of the word in the BitmapText.

w number

The width of the word.

h number

The height of the word.

i number

The index of the word within the line.

word string

The word.

Since: 3.50.0
Source: src/gameobjects/bitmaptext/typedefs/BitmapTextWord.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 number

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)