Skip to main content
Version: Phaser v3.88.2

Types.GameObjects.BitmapText

BitmapFontCharacterData

<static> 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.

nametypeoptionaldescription
xnumberNoThe x position of the character.
ynumberNoThe y position of the character.
widthnumberNoThe width of the character.
heightnumberNoThe height of the character.
centerXnumberNoThe center x position of the character.
centerYnumberNoThe center y position of the character.
xOffsetnumberNoThe x offset of the character.
yOffsetnumberNoThe y offset of the character.
u0numberNoWebGL texture u0.
v0numberNoWebGL texture v0.
u1numberNoWebGL texture u1.
v1numberNoWebGL texture v1.
dataobjectNoExtra data for the character.
kerningObject.<number>NoKerning values, keyed by character code.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapFontCharacterData.js#L1
Since: 3.0.0


BitmapFontData

<static> BitmapFontData

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

nametypeoptionaldescription
fontstringNoThe name of the font.
sizenumberNoThe size of the font.
lineHeightnumberNoThe line height of the font.
retroFontbooleanNoWhether this font is a retro font (monospace).
charsObject.<number, Phaser.Types.GameObjects.BitmapText.BitmapFontCharacterData>NoThe character data of the font, keyed by character code. Each character datum includes a position, size, offset and more.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapFontData.js#L1
Since: 3.0.0


BitmapTextCharacter

<static> 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.

nametypeoptionaldescription
inumberNoThe index of this character within the BitmapText wrapped text string.
idxnumberNoThe index of this character within the BitmapText text string.
charstringNoThe character.
codenumberNoThe character code of the character.
xnumberNoThe x position of the character in the BitmapText.
ynumberNoThe y position of the character in the BitmapText.
wnumberNoThe width of the character.
hnumberNoThe height of the character.
tnumberNoThe top of the line this character is on.
rnumberNoThe right-most point of this character, including xAdvance.
bnumberNoThe bottom of the line this character is on.
linenumberNoThe line number the character appears on.
glyphPhaser.Types.GameObjects.BitmapText.BitmapFontCharacterDataNoReference to the glyph object this character is using.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapTextCharacter.js#L1
Since: 3.50.0


BitmapTextConfig

<static> BitmapTextConfig

nametypeoptionaldefaultdescription
fontstringYes"''"The key of the font to use from the BitmapFont cache.
textstringYes"''"The string, or array of strings, to be set as the content of this Bitmap Text.
sizenumber | falseYesfalseThe font size to set.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapTextConfig.js#L1
Since: 3.0.0


BitmapTextLines

<static> BitmapTextLines

Details about the line data in the BitmapTextSize object.

nametypeoptionaldescription
shortestnumberNoThe width of the shortest line of text.
longestnumberNoThe width of the longest line of text.
heightnumberNoThe height of a line of text.
lengthsArray.<number>NoAn array where each entry contains the length of that line of text.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapTextLines.js#L1
Since: 3.50.0


BitmapTextSize

<static> BitmapTextSize

nametypeoptionaldescription
globalPhaser.Types.GameObjects.BitmapText.GlobalBitmapTextSizeNoThe position and size of the BitmapText, taking into account the position and scale of the Game Object.
localPhaser.Types.GameObjects.BitmapText.LocalBitmapTextSizeNoThe position and size of the BitmapText, taking just the font size into account.
linesPhaser.Types.GameObjects.BitmapText.BitmapTextLinesNoData about the lines of text within the BitmapText.
charactersArray.<Phaser.Types.GameObjects.BitmapText.BitmapTextCharacter>NoAn array containing per-character data. Only populated if includeChars is true in the getTextBounds call.
wordsArray.<Phaser.Types.GameObjects.BitmapText.BitmapTextWord>NoAn array containing the word data from the BitmapText.
scalenumberNoThe scale of the BitmapText font being rendered vs. font size in the text data.
scaleXnumberNoThe scale X value of the BitmapText.
scaleYnumberNoThe scale Y value of the BitmapText.
wrappedTextstringNoThe wrapped text, if wrapping enabled and required.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapTextSize.js#L1
Since: 3.0.0


BitmapTextWord

<static> BitmapTextWord

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

nametypeoptionaldescription
xnumberNoThe x position of the word in the BitmapText.
ynumberNoThe y position of the word in the BitmapText.
wnumberNoThe width of the word.
hnumberNoThe height of the word.
inumberNoThe index of the first character of this word within the entire string. Note: this index factors in spaces, quotes, carriage-returns, etc.
wordstringNoThe word.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/BitmapTextWord.js#L1
Since: 3.50.0


DisplayCallbackConfig

<static> DisplayCallbackConfig

nametypeoptionaldescription
parentPhaser.GameObjects.DynamicBitmapTextNoThe Dynamic Bitmap Text object that owns this character being rendered.
tintPhaser.Types.GameObjects.BitmapText.TintConfigNoThe tint of the character being rendered. Always zero in Canvas.
indexnumberNoThe index of the character being rendered.
charCodenumberNoThe character code of the character being rendered.
xnumberNoThe x position of the character being rendered.
ynumberNoThe y position of the character being rendered.
scalenumberNoThe scale of the character being rendered.
rotationnumberNoThe rotation of the character being rendered.
dataanyNoCustom data stored with the character being rendered.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js#L1
Since: 3.0.0


DisplayCallback

<static> DisplayCallback

Type: function

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js#L16


GlobalBitmapTextSize

<static> GlobalBitmapTextSize

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

nametypeoptionaldescription
xnumberNoThe x position of the BitmapText, taking into account the x position and scale of the Game Object.
ynumberNoThe y position of the BitmapText, taking into account the y position and scale of the Game Object.
widthnumberNoThe width of the BitmapText, taking into account the x scale of the Game Object.
heightnumberNoThe height of the BitmapText, taking into account the y scale of the Game Object.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/GlobalBitmapTextSize.js#L1
Since: 3.0.0


JSONBitmapText

<static> JSONBitmapText

nametypeoptionaldescription
fontstringNoThe name of the font.
textstringNoThe text that this Bitmap Text displays.
fontSizenumberNoThe size of the font.
letterSpacingnumberNoAdds / Removes spacing between characters.
lineSpacingnumberNoAdds / Removes spacing between lines in multi-line text.
alignnumberNoThe alignment of the text in a multi-line BitmapText object.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/JSONBitmapText.js#L1
Since: 3.0.0


LocalBitmapTextSize

<static> LocalBitmapTextSize

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

nametypeoptionaldescription
xnumberNoThe x position of the BitmapText.
ynumberNoThe y position of the BitmapText.
widthnumberNoThe width of the BitmapText.
heightnumberNoThe height of the BitmapText.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/LocalBitmapTextSize.js#L1
Since: 3.0.0


RetroFontConfig

<static> RetroFontConfig

nametypeoptionaldescription
imagestringNoThe key of the image containing the font.
offset.xnumberNoIf the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
offset.ynumberNoIf the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
widthnumberNoThe width of each character in the font set.
heightnumberNoThe height of each character in the font set.
charsstringNoThe characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
charsPerRownumberNoThe number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth.
spacing.xnumberNoIf the characters in the font set have horizontal spacing between them set the required amount here.
spacing.ynumberNoIf the characters in the font set have vertical spacing between them set the required amount here.
lineSpacingnumberNoThe amount of vertical space to add to the line height of the font.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/RetroFontConfig.js#L1
Since: 3.6.0


TintConfig

<static> TintConfig

nametypeoptionaldescription
topLeftnumberNoThe top left tint value. Always zero in canvas.
topRightnumberNoThe top right tint value. Always zero in canvas.
bottomLeftnumberNoThe bottom left tint value. Always zero in canvas.
bottomRightnumberNoThe bottom right tint value. Always zero in canvas.

Type: object

Member of: Phaser.Types.GameObjects.BitmapText

Source: src/gameobjects/bitmaptext/typedefs/TintConfig.js#L1
Since: 3.0.0