- Source: src/gameobjects/text/typedefs/index.js (Line 7)
Type Definitions
-
GetTextSizeObject
-
Results object from a call to GetTextSize.
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/GetTextSizeObject.js (Line 1)
Properties:
Name Type Description widthnumber The width of the longest line in the Text object.
heightnumber The height of the Text object.
linesnumber The number of lines in the Text object.
lineWidthsArray.<number> An array of the lines for each line in the Text object.
lineSpacingnumber The line spacing of the Text object.
lineHeightnumber The height of a line factoring in font and stroke.
-
TextConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/TextConfig.js (Line 1)
Properties:
Name Type Argument Description textstring | Array.<string> <optional>
The text this Text object will display.
stylePhaser.Types.GameObjects.Text.TextStyle <optional>
The Text style configuration object.
paddingPhaser.Types.GameObjects.Text.TextPadding <optional>
A Text Padding object.
-
TextMetrics
-
Font metrics for a Text Style object.
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/TextMetrics.js (Line 1)
Properties:
Name Type Description ascentnumber The ascent of the font.
descentnumber The descent of the font.
fontSizenumber The size of the font.
-
TextPadding
-
A Text Padding configuration object as used by the Text Style.
Type:
- object
- Since: 3.18.0
- Source: src/gameobjects/text/typedefs/TextPadding.js (Line 1)
Properties:
Name Type Argument Description xnumber <optional>
If set this value is used for both the left and right padding.
ynumber <optional>
If set this value is used for both the top and bottom padding.
leftnumber <optional>
The amount of padding added to the left of the Text object.
rightnumber <optional>
The amount of padding added to the right of the Text object.
topnumber <optional>
The amount of padding added to the top of the Text object.
bottomnumber <optional>
The amount of padding added to the bottom of the Text object.
-
TextShadow
-
A Text Shadow configuration object as used by the Text Style.
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/TextShadow.js (Line 1)
Properties:
Name Type Argument Default Description offsetXnumber <optional>
0 The horizontal offset of the shadow.
offsetYnumber <optional>
0 The vertical offset of the shadow.
colorstring <optional>
'#000' The color of the shadow, given as a CSS string value.
blurnumber <optional>
0 The amount of blur applied to the shadow. Leave as zero for a hard shadow.
strokeboolean <optional>
false Apply the shadow to the stroke effect on the Text object?
fillboolean <optional>
false Apply the shadow to the fill effect on the Text object?
-
TextStyle
-
A Text Style configuration object as used by the Text Game Object.
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/TextStyle.js (Line 1)
Properties:
Name Type Argument Default Description fontFamilystring <optional>
'Courier' The font the Text object will render with. This is a Canvas style font string.
fontSizestring <optional>
'16px' The font size, as a CSS size string.
fontStylestring <optional>
Any addition font styles, such as 'strong'.
fontstring <optional>
The font family or font settings to set. Overrides the other font settings.
backgroundColorstring <optional>
A solid fill color that is rendered behind the Text object. Given as a CSS string color such as
#ff0.colorstring <optional>
'#fff' The color the Text is drawn in. Given as a CSS string color such as
#ffforrgb().strokestring <optional>
'#fff' The color used to stroke the Text if the
strokeThicknessproperty is greater than zero.strokeThicknessnumber <optional>
0 The thickness of the stroke around the Text. Set to zero for no stroke.
shadowPhaser.Types.GameObjects.Text.TextShadow <optional>
The Text shadow configuration object.
paddingPhaser.Types.GameObjects.Text.TextPadding <optional>
A Text Padding object.
alignstring <optional>
'left' The alignment of the Text. This only impacts multi-line text. Either
left,right,centerorjustify.maxLinesnumber <optional>
0 The maximum number of lines to display within the Text object.
fixedWidthnumber <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.
fixedHeightnumber <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.
resolutionnumber <optional>
0 Sets the resolution (DPI setting) of the Text object. Leave at zero for it to use the game resolution.
rtlboolean <optional>
false Set to
trueif this Text object should render from right-to-left.testStringstring <optional>
'|MÉqgy' This is the string used to aid Canvas in calculating the height of the font.
baselineXnumber <optional>
1.2 The amount of horizontal padding added to the width of the text when calculating the font metrics.
baselineYnumber <optional>
1.4 The amount of vertical padding added to the height of the text when calculating the font metrics.
wordWrapPhaser.Types.GameObjects.Text.TextWordWrap <optional>
The Text Word wrap configuration object.
metricsPhaser.Types.GameObjects.Text.TextMetrics <optional>
A Text Metrics object. Use this to avoid expensive font size calculations in text heavy games.
-
TextWordWrap
-
A Text Word Wrap configuration object as used by the Text Style configuration.
Type:
- object
- Since: 3.0.0
- Source: src/gameobjects/text/typedefs/TextWordWrap.js (Line 1)
Properties:
Name Type Argument Default Description widthnumber <optional>
The width at which text should be considered for word-wrapping.
callbackTextStyleWordWrapCallback <optional>
Provide a custom callback when word wrapping is enabled.
callbackScopeany <optional>
The context in which the word wrap callback is invoked.
useAdvancedWrapboolean <optional>
false Use basic or advanced word wrapping?
