TextStyleProps
Type definitions
type TextStyleProps = { width?: number; height?: number; maxWidth?: number; maxHeight?: number; fontSize: number; lineHeight?: number; color?: string; backgroundColor?: string; fontFamily?: string; fontStyle?: "normal" | "italic" | "oblique"; align?: "left" | "right" | "justified" | "center"; wrap?: "none" | "glyph" | "word"; fontWeight?: | "thin" | "extra_light" | "light" | "normal" | "medium" | "semi_bold" | "bold" | "extra_bold" | "black";}
Properties
width
Specifies the width of the texture for rendering text. If undefined, the texture size adjusts to the text while not exceeding the max_width
.
- Type:
number
height
Sets the height of the texture for rendering text. If undefined, the texture size adjusts to the text up to the max_height
.
- Type:
number
maxWidth
Limits the width of the texture that the text will be rendered on.
- Type:
number
- Default value:
7682
maxHeight
Limits the height of the texture that the text will be rendered on.
- Type:
number
- Default value:
4320
fontSize
Font size in pixels.
- Type:
number
lineHeight
Distance between lines in pixels.
- Type:
number
- Default value: value of the
fontSize
color
Font color in #RRGGBBAA
or #RRGGBB
format.
- Type:
string
- Default value:
#FFFFFFFF
backgroundColor
Background color in #RRGGBBAA
or #RRGGBB
format.
- Type:
string
- Default value:
#00000000
fontFamily
Font family. Specifies the family name of the font. Note that “generic-family” values such as “sans-serif” are not supported.
- Type:
string
- Default value:
"Verdana"
style
Font style. The selected font needs to support the specified style.
- Type:
"normal" | "italic" | "oblique";
- Default value:
"normal"
align
Text align.
- Type:
"left" | "right" | "justified" | "center"
- Default value:
"left"
wrap
Defines the options for handling text that exceeds the available space.
- Type:
"none" | "glyph" | "word"
- Default value:
"none"
- Supported values:
"none"
- Disables text wrapping; any text that exceeds the texture boundary will be truncated."glyph"
- Enables text wrapping at the glyph level."word"
- Wraps text at the word level, preventing word splits during wrapping.
fontWeight
Specifies the weight of the font, as defined in the OpenType specification. Ensure the selected font supports this weight.
- Type:
"thin" | "extra_light" | "light" | "normal" | "medium" | "semi_bold" | "bold" | "extra_bold" | "black"
- Default value:
"normal"
- Supported values:
"thin"
- Weight 100."extra_light"
- Weight 200."light"
- Weight 300."normal"
- Weight 400."medium"
- Weight 500."semi_bold"
- Weight 600."bold"
- Weight 700."extra_bold"
- Weight 800."black"
- Weight 900.