A Text Style configuration object as used by the Text Game Object.
name | type | arguments | Default | description |
---|---|---|---|---|
fontFamily | string | <optional> | 'Courier' |
The font the Text object will render with. This is a Canvas style font string. |
fontSize | string | <optional> | '16px' |
The font size, as a CSS size string. |
fontStyle | string | <optional> |
Any addition font styles, such as 'strong'. |
|
font | string | <optional> |
The font family or font settings to set. Overrides the other font settings. |
|
backgroundColor | string | <optional> |
A solid fill color that is rendered behind the Text object. Given as a CSS string color such as |
|
color | string | <optional> | '#fff' |
The color the Text is drawn in. Given as a CSS string color such as |
stroke | string | <optional> | '#fff' |
The color used to stroke the Text if the |
strokeThickness | number | <optional> | 0 |
The thickness of the stroke around the Text. Set to zero for no stroke. |
shadow | Phaser.Types.GameObjects.Text.TextShadow | <optional> |
The Text shadow configuration object. |
|
padding | Phaser.Types.GameObjects.Text.TextPadding | <optional> |
A Text Padding object. |
|
align | string | <optional> | 'left' |
The alignment of the Text. This only impacts multi-line text. Either |
maxLines | number | <optional> | 0 |
The maximum number of lines to display within the Text object. |
fixedWidth | number | <optional> | 0 |
Force the Text object to have the exact width specified in this property. Leave as zero for it to change accordingly to content. |
fixedHeight | number | <optional> | 0 |
Force the Text object to have the exact height specified in this property. Leave as zero for it to change accordingly to content. |
resolution | number | <optional> | 0 |
Sets the resolution (DPI setting) of the Text object. Leave at zero for it to use the game resolution. |
rtl | boolean | <optional> | false |
Set to |
testString | string | <optional> | '|MÉqgy' |
This is the string used to aid Canvas in calculating the height of the font. |
baselineX | number | <optional> | 1.2 |
The amount of horizontal padding added to the width of the text when calculating the font metrics. |
baselineY | number | <optional> | 1.4 |
The amount of vertical padding added to the height of the text when calculating the font metrics. |
wordWrap | Phaser.Types.GameObjects.Text.TextWordWrap | <optional> |
The Text Word wrap configuration object. |
|
metrics | Phaser.Types.GameObjects.Text.TextMetrics | <optional> |
A Text Metrics object. Use this to avoid expensive font size calculations in text heavy games. |