Class: TextComponent
Rendered via the backend's ITextRenderer. Font resolution: registered fontAssetId wins (TTF/OTF
Font-face
or bitmap font); otherwise fontFamily is treated as a system font.
Extends
Constructors
Constructor
ts
new TextComponent(
text?,
fontAssetId?,
fontFamily?,
fontSize?,
color?,
align?,
lineHeight?,
wrapEnabled?,
shrinkToFit?,
crispText?,
stroke?,
strokeColor?,
strokeWidth?,
dropShadow?,
dropShadowColor?,
dropShadowBlur?,
dropShadowDistance?
): TextComponent;Parameters
| Parameter | Type | Default value |
|---|---|---|
text | string | "" |
fontAssetId | string | Font | "" |
fontFamily | string | "sans-serif" |
fontSize | number | 24 |
color | ColorSource | 0xFFFFFF |
align | TextAlign | TextAlign.Left |
lineHeight | number | 40 |
wrapEnabled | boolean | false |
shrinkToFit | boolean | false |
crispText | boolean | false |
stroke | boolean | false |
strokeColor | ColorSource | 0x000000 |
strokeWidth | number | 2 |
dropShadow | boolean | false |
dropShadowColor | ColorSource | 0x000000 |
dropShadowBlur | number | 2 |
dropShadowDistance | number | 4 |
Returns
TextComponent
Overrides
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
align | public | TextAlign | undefined | - | - |
color | public | ColorSource | undefined | - | - |
crispText | public | boolean | undefined | - | - |
dirty | public | boolean | true | - | Component.dirty |
dropShadow | public | boolean | undefined | - | - |
dropShadowBlur | public | number | undefined | - | - |
dropShadowColor | public | ColorSource | undefined | - | - |
dropShadowDistance | public | number | undefined | - | - |
enabled | public | boolean | true | - | Component.enabled |
fontAssetId | public | string | undefined | - | - |
fontFamily | public | string | undefined | - | - |
fontSize | public | number | undefined | - | - |
lineHeight | public | number | undefined | - | - |
material | public | string | undefined | Material slot (MaterialFields.ts). | - |
materialValues | public | Record<string, unknown> | undefined | - | - |
shrinkToFit | public | boolean | undefined | - | - |
stroke | public | boolean | undefined | - | - |
strokeColor | public | ColorSource | undefined | - | - |
strokeWidth | public | number | undefined | - | - |
text | public | string | undefined | - | - |
wrapEnabled | public | boolean | undefined | - | - |
Accessors
font
Get Signature
ts
get font(): Font;Returns
Set Signature
ts
set font(f): void;Parameters
| Parameter | Type |
|---|---|
f | Font |
Returns
void