TextComponent
Native text component
Provides access to a native text component instance
- TextComponent
- .TextComponent.TypeName: string
- .alignment
- .characterSpacing
- .effect
.justification- .lineSpacing
- .material
- .text
- .verticalAlignment
- .wrapMode
- .wrapWidth
- .getBoundingBox<T>(out) ⇒ T
- .getBoundingBoxForText<T>(text, out) ⇒ T
.TypeName: string
.alignment: Alignment
Text component alignment.
.alignment
Set text component alignment.
.characterSpacing: number
Text component character spacing.
.characterSpacing
Set text component character spacing.
.effect: TextEffect
Text component effect.
.effect
Set text component effect
.justification: VerticalAlignment
Text component justification.
Deprecated: Please use verticalAlignment instead.
.justification
Set text component justification.
Deprecated: Please use verticalAlignment instead.
.lineSpacing: number
Text component line spacing.
.lineSpacing
Set text component line spacing
.material: null | Material
Material used to render the text.
.material
Set material to render the text with.
.text: string
Text component text.
.text
Set text component text.
.verticalAlignment: VerticalAlignment
1.2.0+Text component vertical alignment.
.verticalAlignment
1.2.0+Set text component vertical alignment.
.wrapMode: TextWrapMode
1.2.1+Text component line wrap mode.
.wrapMode
1.2.1+Set text component line wrap mode.
.wrapWidth: number
1.2.1+Text component line wrap width.
.wrapWidth
1.2.1+Set text component line wrap width.
Only takes effect when wrapMode is something other than None.
.getBoundingBox<T>(out: T) ⇒ T
.getBoundingBox() ⇒ Float32Array
Axis-aligned bounding box, in object space.
The bounding box is computed using the current component properties that influence the position and size of the text. The bounding box is affected by alignment, spacing, effect type and the font set in the material.
To calculate the size for a different text, use getBoundingBoxForText.
Useful for adjusting text position or scaling:
Returns: Bounding box - left, bottom, right, top.
Param | Type | Description |
---|---|---|
out | T | Preallocated array to write into, to avoid garbage, otherwise will allocate a new Float32Array. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.getBoundingBoxForText<T>(text: string, out: T) ⇒ T
.getBoundingBoxForText(text: string) ⇒ Float32Array
Axis-aligned bounding box for a given text, in object space.
To calculate the size for the currently set text, use getBoundingBox.
Useful for calculating the text size before an update and potentially adjusting the text:
Returns: Bounding box - left, bottom, right, top.
Param | Type | Description |
---|---|---|
text | string | Text string to calculate the bounding box for. |
out | T | Preallocated array to write into, to avoid garbage, otherwise will allocate a new Float32Array. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |