Used for drawing text using embedded fonts.
Constructor
new (text : String = "", x : Float = 0, y : Float = 0, width : Int = 0, height : Int = 0, options : TextOptions) : Void
Text constructor.
Parameters:
text | Text to display. | |
x | X offset. | |
y | Y offset. | |
width | Image width (leave as 0 to size to the starting text string). | |
height | Image height (leave as 0 to size to the starting text string). | |
options | An object containing optional parameters contained in TextOptions font Font family. size Font size. align Alignment (one of: TextFormatAlign.LEFT, TextFormatAlign.CENTER, TextFormatAlign.RIGHT, TextFormatAlign.JUSTIFY). wordWrap Automatic word wrapping. resizable If the text field can automatically resize if its contents grow. color Text color. leading Vertical space between lines. richText If the text field uses a rich text string |
Variables
richText : String
Rich-text string with markup.
Use Text.addStyle
to control the appearance of marked-up text.
Functions
addStyle (tagName : String, params : StyleType) : Void
Add a style for a subset of the text, for use with the richText property.
Usage:
text.addStyle("red", {color: 0xFF0000});
text.addStyle("big", {size: text.size * 2, bold: true});
text.richText = "<big>Hello</big> <red>world</red>";
getTextProperty (name : String) : Dynamic
Gets the specified property, by also inspecting the underlying TextField and TextFormat objects. Returns null if the property doesn't exist.
setBorder (style : BorderStyle = BorderStyle.FastOutline, size : Int = 1, color : Color = Color.Black, alpha : Float = 1) : Void
setTextProperty (name : String, value : Dynamic) : Bool
Sets the specified property, by also inspecting the underlying TextField and TextFormat objects. Returns true if the property has been found and set, false otherwise.