Skip to content
TextBlock

UI / TextBlock

TextBlock Class ​

Text

Hierarchy ​

Table of contents ​

Properties ​

click

Properties ​

onCustomPropertyChange: Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> other
Monitor custom attribute synchronization events

Accessors ​

autoAdjust(): boolean other
Get whether the font is adaptive to adjust: boolean (when true, the font size of text content will automatically change to fill the entire text box as large as possible, while the text box size will not change)
contentColor(): LinearColor other
Get font content color
fontColor(): LinearColor other
Get font color
fontLetterSpace(): number other
Get font spacing
fontSize(): number other
Get font size
glyph(): UIFontGlyph other
Get font and glyph shapes
isRichText(): boolean other
Get whether it is rich text
lineHeightPercentage(): number other
Get row height coefficient
maxSize(): number other
Get the current text content
minSize(): number other
Get the current text content
outlineColor(): LinearColor other
Get font outline color
outlineSize(): number other
Get font outline width
shadowColor(): LinearColor other
Set font shadow color
shadowOffset(): Vector2 other
Get font shadow color
strikethroughEnable(): boolean other
Get whether to enable font strikethrough
text(): string <Badge type="tip" text="other" />
Get the current text content
textAlign(): TextJustify other
Get font align
textHeight(): number other
Get the height of the text (the overall height of the text content, regardless of component size, affected by font properties)
textHorizontalLayout(): UITextHorizontalLayout other
Get the horizontal display mode of the current font
textJustification(): TextJustify other
Get the align of the font
textSingleHeight(): number other
Get the height of a single text line (the height of a single text line is independent of the size of the component and is affected by the font property)
textVerticalAlign(): TextVerticalJustify other
Get the vertical alignment of the font
textVerticalJustification(): TextVerticalJustify other
Get the vertical alignment of the font
underlineEnable(): boolean other
Return whether to enable font underline
click

Accessors ​

alignPosition(): Readonly<Vector2> other
Get the align position of the widget. When the align method is right align, bottom align, and center align, the value of alignPosition is different from that of position;
autoSizeHorizontalEnable(): boolean other
Get whether to automatically set the size horizontally
autoSizeVerticalEnable(): boolean other
Get whether to set the size automatically vertical
cachedGeometry(): Geometry other
Get the previous Get TickSpaceGeometry
constraints(): Readonly<UIConstraintAnchors> other
Get the layout of the control
desiredSize(): Vector2 other
Obtain expected size
enable(): boolean other
Is it available
guid(): string other
Get the widget GUID
isHovered(): boolean other
Is it hovered
mouseCursor(): MouseCursor other
Get the cursor type on the widget
name(): string other
Get Name
paintSpaceGeometry(): Geometry other
Get the last geometric information used to render the Widget
parent(): Widget other
Get parent node
pivot(): Vector2 other
Get the position of the widget anchor. This property determine the relative position of the widget graph and the anchor; At (0,0), the anchor point is located in the upper left corner of the control; (0.5,0.5), the anchor is at the center of the widget
position(): Readonly<Vector2> other
Get the position of the control
renderOpacity(): number other
Obtain rendering transparency
renderScale(): Vector2 other
Get rendering scaling
renderShear(): Vector2 other
Obtain rendering misalignment deformation
renderTransformAngle(): number other
Obtain the rendering angle
renderTransformPivot(): Vector2 other
Get Render anchor
size(): Vector2 other
Get size
tickSpaceGeometry(): Geometry other
Retrieve the last geometric information used to drive Widget Tick
transform(): Readonly<UITransform> other
Obtain the size and position of the control
visibility(): SlateVisibility other
Get visibility
visible(): boolean other
Is it visible
zOrder(): number other
Get Zorder

Methods ​

setFontColorByHex(inHexString: string): void other
Set font color, specify the color of Hex text Set Color # 05050505
setFontColorDecimal(R: number, G: number, B: number, A: number): void other
Set font color
setOutlineColorByHex(inHexString: string): void other
Set the current stroke color
setOutlineColorDecimal(R: number, G: number, B: number, A: number): void other
Set the current stroke color
setShadowColorByHex(inHexString: string): void other
Set the shadow color of the font. Shadow Offset must be set to see the effect. Specify the color of Hex. Set the color of text # 05050505
setShadowColorDecimal(R: number, G: number, B: number, A: number): void other
Set the shadow color of the font
newObject(parent?: Canvas, inName?: string): TextBlock other
Create TextBlock control
click

Methods ​

addChild(child: Widget): void other
Add child nodes
clone(position: Vector2, Parent?: any): Widget other
Clone the UI widget and its child nodes to the specified parent widget position (default to its parent node)
destroyObject(): void other
Remove and destroy immediately. Cannot be used again
equal(that: Widget): boolean other
Determine if it is the same object
findChildByPath(inPath: string): Widget other
Find nodes by relative path
getChildAt(index: number): Widget other
What is the position node to obtain
getChildByName<T: extends Widget<T>>(name: string): T: extends Widget<T> other
Search for nodes by name
getChildrenCount(): number other
Obtain the number of child nodes
getCustomProperties(): string[] other
Get all customize property
getCustomProperty<T: extends CustomPropertyType>(propertyName: string): T: extends CustomPropertyType other
Get customize property
getCustomPropertyChangeDelegate(property): Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> other
Event proxy triggered when a given object property is modified
invalidateLayoutAndVolatility(): void other
Immediately trigger re rendering and layout calculation
removeAllChildren(): void other
Clearing all child nodes will destroy the UI and render it unusable
removeChild(child: Widget): void other
Removing a node will destroy the UI and make it unusable
removeChildAt(index: number): void other
Removing the third node will destroy the UI and render it unusable
removeObject(): void other
Immediately remove and add to the root node for reuse
serialize(): string other
Serialize UI widget
setCustomProperty(propertyName: string, value: undefined CustomPropertyType): void other
Set custom attributes
deserialize(Data: string, Parent?: Widget): Widget other
Deserialize UI

Properties ​

Accessors ​


autoAdjust ​

• get autoAdjust(): boolean other

• set autoAdjust(isAdjust): void other

Get whether the font is adaptive to adjust: boolean (when true, the font size of text content will automatically change to fill the entire text box as large as possible, while the text box size will not change)

Returns ​

booleanIs the font adaptively resized

Set whether the font is adaptive to adjust: boolean (when true, the font size of text content will automatically change to fill the entire text box as large as possible, while the text box size will not change)

Parameters ​

isAdjust booleanUsage: Whether the font is adaptive to adjust

contentColor ​

• get contentColor(): LinearColor other

• set contentColor(inContentColor): void other

Get font content color

Returns ​

LinearColorFont content color, TypeLinearColor type, data range 0~1

Set font content color

Parameters ​

inContentColor LinearColorContent color, TypeLinearColor type, data range 0~1

fontColor ​

• get fontColor(): LinearColor other

• set fontColor(inColor): void other

Get font color

Returns ​

LinearColorFont color, TypeLinearColor type, data range 0~1

Set font color

Parameters ​

inColor LinearColorUsage: Color value of font, TypeLinearColor type, data range 0~1

fontLetterSpace ​

• get fontLetterSpace(): number other

• set fontLetterSpace(inLetterSpace): void other

Get font spacing

Returns ​

numberReturn font spacing

Set font spacing

Parameters ​

inLetterSpace numberUsage: font spacing

fontSize ​

• get fontSize(): number other

• set fontSize(InSize): void other

Get font size

Returns ​

numberReturn the font size

Set font size

Parameters ​

InSize numberUsage: font size

glyph ​

• get glyph(): UIFontGlyph other

• set glyph(inGlyph): void other

Get font and glyph shapes

Returns ​

UIFontGlyphFont Shape

Set font and glyph shape

Parameters ​

inGlyph UIFontGlyphGlyph

isRichText ​

• get isRichText(): boolean other

• set isRichText(isRichText): void other

Get whether it is rich text

Returns ​

booleanIs it rich text

Set rich text

Parameters ​

isRichTextboolean

lineHeightPercentage ​

• get lineHeightPercentage(): number other

• set lineHeightPercentage(inValue): void other

Get row height coefficient

Returns ​

numberRow height coefficient

Set row height coefficient

Parameters ​

inValue numberUsage: coefficient

maxSize ​

• get maxSize(): number other

• set maxSize(inText): void other

Get the current text content

Returns ​

numberReturn the current text content

Set text content

Parameters ​

inText numberUsage: text content

minSize ​

• get minSize(): number other

• set minSize(inText): void other

Get the current text content

Returns ​

numberReturn the current text content

Set text content

Parameters ​

inText numberUsage: text content

outlineColor ​

• get outlineColor(): LinearColor other

• set outlineColor(inOutlineColor): void other

Get font outline color

Returns ​

LinearColorFont stroke color, TypeLinearColor type, data range 0~1

Set font outline color

Parameters ​

inOutlineColor LinearColorStroke color, TypeLinearColor type, data range 0~1

Font outline Color


outlineSize ​

• get outlineSize(): number other

• set outlineSize(inOutlineSize): void other

Get font outline width

Returns ​

numberFont stroke width

Set font outline width

Parameters ​

inOutlineSize numberUsage: Set size

shadowColor ​

• get shadowColor(): LinearColor other

• set shadowColor(inShadowColor): void other

Set font shadow color

Returns ​

LinearColorShadow color, TypeLinearColor type, data range 0~1

Get font shadow color

Parameters ​

inShadowColor LinearColorUsage: Shadow color, TypeLinearColor type, data range 0~1

shadowOffset ​

• get shadowOffset(): Vector2 other

• set shadowOffset(inOffset): void other

Get font shadow color

Returns ​

Vector2Font shadow color, TypeLinearColor type, data range 0~1

Set font shadow offset

Parameters ​

inOffset Vector2Usage: shadow offset

strikethroughEnable ​

• get strikethroughEnable(): boolean other

• set strikethroughEnable(inEnableStrikethrough): void other

Get whether to enable font strikethrough

Returns ​

booleanDo you want to enable font strikethrough

Set whether to enable font strikethrough

Parameters ​

inEnableStrikethrough booleanUsage: Is it enabled

text ​

• get text(): string other

• set text(inText): void other

Get the current text content

Returns ​

stringReturn the current text content

Set text content

Parameters ​

inText stringUsage: text content

textAlign ​

• get textAlign(): TextJustify other

• set textAlign(inTextJustify): void other

Get font align

Returns ​

TextJustifyFont align

Set font align

Parameters ​

inTextJustify TextJustifyUsage: enumeration of align

textHeight ​

• get textHeight(): number other

Get the height of the text (the overall height of the text content, regardless of component size, affected by font properties)

Returns ​

numberText height

textHorizontalLayout ​

• get textHorizontalLayout(): UITextHorizontalLayout other

• set textHorizontalLayout(inTextHorizontalLayout): void other

Get the horizontal display mode of the current font

Returns ​

UITextHorizontalLayoutReturns the horizontal display of the font

Set the horizontal display mode of the font

Parameters ​

inTextHorizontalLayout UITextHorizontalLayoutUsage: horizontal display mode

textJustification ​

• get textJustification(): TextJustify other

• set textJustification(inTextJustification): void other

Get the align of the font

Returns ​

TextJustifyReturn the alignment of the font

Set the alignment of fonts

Parameters ​

inTextJustification TextJustifyUsage: New alignment method

textSingleHeight ​

• get textSingleHeight(): number other

Get the height of a single text line (the height of a single text line is independent of the size of the component and is affected by the font property)

Returns ​

numberText single line height

textVerticalAlign ​

• get textVerticalAlign(): TextVerticalJustify other

• set textVerticalAlign(inTextVerticalJustify): void other

Get the vertical alignment of the font

Returns ​

TextVerticalJustifyFont vertical align

Set font vertical alignment method

Parameters ​

inTextVerticalJustify TextVerticalJustifyVertical align

textVerticalJustification ​

• get textVerticalJustification(): TextVerticalJustify other

• set textVerticalJustification(inTextJustification): void other

Get the vertical alignment of the font

Returns ​

TextVerticalJustifyReturn the vertical alignment of the font

Set the vertical alignment of the font

Parameters ​

inTextJustification TextVerticalJustifyUsage: vertical align

underlineEnable ​

• get underlineEnable(): boolean other

• set underlineEnable(inEnableUnderline): void other

Return whether to enable font underline

Returns ​

booleanGet whether to enable font underline

Set whether to enable font underline

Parameters ​

inEnableUnderline booleanUsage: Set whether to enable underline

Methods ​


setFontColorByHex ​

• setFontColorByHex(inHexString): void other

Set font color, specify the color of Hex text Set Color # 05050505

Parameters ​

inHexString stringUsage: Hex color string range: string type conforming to Hex characteristics

setFontColorDecimal ​

• setFontColorDecimal(R, G, B, A): void other

Set font color

Parameters ​

R numberUsage: Font color R value< Range: [0, 255] type: integer
G numberUsage: Font color G value< Range: [0, 255] type: integer
B numberUsage: Font color B value< Range: [0, 255] type: integer
A numberUsage: Font color transparency< Range: [0, 255] type: integer

setOutlineColorByHex ​

• setOutlineColorByHex(inHexString): void other

Set the current stroke color

Parameters ​

inHexString stringUsage: hexadecimal string range: string type conforming to Hex characteristics

For example: # 05050505


setOutlineColorDecimal ​

• setOutlineColorDecimal(R, G, B, A): void other

Set the current stroke color

Parameters ​

R numberUsage: Color R value< Range: [0, 255] type: integer
G numberUsage: Color G value< Range: [0, 255] type: integer
B numberUsage: Color B value< Range: [0, 255] type: integer
A numberUsage: Color transparency< Range: [0, 255] type: integer

setShadowColorByHex ​

• setShadowColorByHex(inHexString): void other

Set the shadow color of the font. Shadow Offset must be set to see the effect. Specify the color of Hex. Set the color of text # 05050505

Parameters ​

inHexString stringUsage: Color range: String type that conforms to Hex characteristics

setShadowColorDecimal ​

• setShadowColorDecimal(R, G, B, A): void other

Set the shadow color of the font

Parameters ​

R numberUsage: Shadow color R value< Range: [0, 255] type: integer
G numberUsage: Shadow color G value< Range: [0, 255] type: integer
B numberUsage: Shadow color B value< Range: [0, 255] type: integer
A numberUsage: Shadow color transparency< Range: [0, 255] type: integer

Shadow Offset Values must be set to see the effect.


newObject ​

• Static newObject(parent?, inName?): TextBlock other

Create TextBlock control

Parameters ​

parent? CanvasUsage: Create the external parent object of the control with default: null
inName? stringUsage: name of the create widget default: null range: set a reasonable name

Returns ​

TextBlockReturn the created object

When the parent and inName are the same as an existing object, the old object will be destroyed