Text2D
- Last UpdatedSep 26, 2025
- 3 minute read
The Text2D node displays text on a 2D label.
-
It supports font customization and text alignment.
-
Text2D inherits from RectBase2D.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Text alignment
-
Both horizontal (formatH) and vertical (formatV) are provided to better position the text inside the Text2D area.
-
The formatH parameter supports:
-
Left: Aligns the text on the left of the Text2D area.
-
Center: Aligns the text on the center of the Text2D area.
-
Right: Aligns the text on the right of the Text2D area.
-
Autoline: Provides automatic line wrap and justified text alignment.
-
LineWrap: Provides automatic line wrap with text aligned to the left of the Text2D area.
-
-
Text2D supports multi-line text and new line character ('\n').
Code example
This is a code example for Text2D.
<Text2D name="text" templateInfo="Text2D|text" position="28.40707 63.37631" size="200 40" scale="1.034259 1.034259" visible="true" text="This is a text" parent="rect"/>
Text2D fields
These are the fields for Text2D node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase2D > Text2D
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
autoRefresh |
sbool |
Optional |
true |
When set to true, the text string content is resolved at every frame and the display updates if changed. |
|
color |
svec3 |
Optional |
1 1 1 |
The RGB text color. |
|
dynamicFontScaling |
sbool |
Optional |
true |
Improves the quality of text by applying Dynamic Font Scaling rendering. |
|
font |
sstring |
Optional |
Arial,Regular,20 |
Text font. |
|
formatH |
senum |
Optional |
Left |
Specifies the text horizontal alignment. Available options are Left, Center, Right, Autoline, LineWrap. |
|
formatV |
senum |
Optional |
Top |
Select the text vertical alignment as Top, Center, or Bottom. |
|
password |
sbool |
Optional |
false |
When set to true, the asterisk (*) appears in place of text letters. |
|
text |
sstring |
Optional |
Displayed text. It supports newline and ('\n'). |
