The Text object that this TextStyle is styling.
The style settings to set.
The text alignment.
The background color.
The amount of horizontal padding added to the width of the text when calculating the font metrics.
The amount of vertical padding added to the height of the text when calculating the font metrics.
The text fill color.
The fixed height of the text.
0 means no fixed height.
The fixed width of the text.
0 means no fixed with.
The font family.
The font size.
The font style.
The maximum number of lines to draw.
The Text object that this TextStyle is styling.
The resolution the text is rendered to its internal canvas at. The default is 0, which means it will use the resolution set in the Game Config.
Whether the text should render right to left.
The shadow blur radius.
The shadow color.
Whether shadow fill is enabled or not.
The horizontal shadow offset.
The vertical shadow offset.
Whether shadow stroke is enabled or not.
The text stroke color.
The text stroke thickness.
The test string to use when measuring the font.
A custom function that will be responsible for wrapping the text. It will receive two arguments: text (the string to wrap), textObject (this Text instance). It should return the wrapped lines either as an array of lines or as a string with newline characters in place to indicate where breaks should happen. Setting this directly will not re-run the word wrapping algorithm. To change the callback and re-wrap, use Phaser.GameObjects.TextStyle#setWordWrapCallback.
The scope that will be applied when the wordWrapCallback is invoked. Setting this directly will not re-run the word wrapping algorithm. To change the callback and re-wrap, use Phaser.GameObjects.TextStyle#setWordWrapCallback.
Whether or not to use the advanced wrapping algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, spaces and whitespace are left as is. Setting this property directly will not re-run the word wrapping algorithm. To change the advanced setting and re-wrap, use Phaser.GameObjects.TextStyle#setWordWrapWidth.
The maximum width of a line of text in pixels. Null means no line wrapping. Setting this property directly will not re-run the word wrapping algorithm. To change the width and re-wrap, use Phaser.GameObjects.TextStyle#setWordWrapWidth.
Destroy this Text Style.
Get the current text metrics.
Set the alignment of the text in this Text object.
The argument can be one of: left, right, center or justify.
Alignment only works if the Text object has more than one line of text.
Optionalalign: stringThe text alignment for multi-line text. Default 'left'.
Set the text fill color.
The text fill color.
Set the text fill color.
The text fill color.
Set a fixed width and height for the text.
Pass in 0 for either of these parameters to disable fixed width or height respectively.
The fixed width to set.
The fixed height to set.
Set the font.
If a string is given, the font family is set.
If an object is given, the fontFamily, fontSize and fontStyle
properties of that object are set.
The font family or font settings to set.
OptionalupdateText: booleanWhether to update the text immediately. Default true.
Set the font size. Can be a string with a valid CSS unit, i.e. 16px, or a number.
The font size.
Set the maximum number of lines to draw.
Optionalmax: numberThe maximum number of lines to draw. Default 0.
Set the resolution used by the Text object.
It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger internal Canvas textures for the Text.
Please use with caution, as the more high res Text you have, the more memory it uses up.
The resolution for this Text object to use.
Set the shadow settings.
Calling this method always re-measures the parent Text object, so only call it when you actually change the shadow settings.
Optionalx: numberThe horizontal shadow offset. Default 0.
Optionaly: numberThe vertical shadow offset. Default 0.
Optionalcolor: stringThe shadow color. Default '#000'.
Optionalblur: numberThe shadow blur radius. Default 0.
OptionalshadowStroke: booleanWhether to stroke the shadow. Default false.
OptionalshadowFill: booleanWhether to fill the shadow. Default true.
Set the shadow blur radius.
Optionalblur: numberThe shadow blur radius. Default 0.
Set the shadow color.
Optionalcolor: stringThe shadow color. Default '#000'.
Enable or disable shadow fill.
Whether shadow fill is enabled or not.
Set the shadow offset.
Optionalx: numberThe horizontal shadow offset. Default 0.
Optionaly: numberThe vertical shadow offset. Default 0.
Enable or disable shadow stroke.
Whether shadow stroke is enabled or not.
Set the stroke settings.
The stroke color.
The stroke thickness.
Set the text style.
The style settings to set.
OptionalupdateText: booleanWhether to update the text immediately. Default true.
OptionalsetDefaults: booleanUse the default values if not set, or the local values. Default false.
Set the test string to use when measuring the font.
The test string to use when measuring the font.
Set a custom callback for wrapping lines.
Pass in null to remove wrapping by callback.
A custom function that will be responsible for wrapping the text. It will receive two arguments: text (the string to wrap), textObject (this Text instance). It should return the wrapped lines either as an array of lines or as a string with newline characters in place to indicate where breaks should happen.
Optionalscope: objectThe scope that will be applied when the callback is invoked. Default null.
Set the width (in pixels) to use for wrapping lines.
Pass in null to remove wrapping by width.
The maximum width of a line in pixels. Set to null to remove wrapping.
OptionaluseAdvancedWrap: booleanWhether or not to use the advanced wrapping algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, spaces and whitespace are left as is. Default false.
Synchronize the font settings to the given Canvas Rendering Context.
The Canvas Element.
The Canvas Rendering Context.
Synchronize the shadow settings to the given Canvas Rendering Context.
The Canvas Rendering Context.
Whether shadows are enabled or not.
Synchronize the text style settings to the given Canvas Rendering Context.
The Canvas Element.
The Canvas Rendering Context.
Build a JSON representation of this Text Style.
Update the style settings for the parent Text object.
Whether to recalculate font and text metrics.
A TextStyle class manages all of the style settings for a Text object.
Text Game Objects create a TextStyle instance automatically, which is accessed via the
Text.styleproperty. You do not normally need to instantiate one yourself.