Optional
options: Partial<TextRendererOptions>The text color
Flip the text horizontally
Flip the text vertically
The font family to use
The size of the font in pixels.
The height of the invisible box where the text is rendered
The render layer
The space between chars in pixels
The height of the line in pixels. Default value is equal to the font size
X-axis and Y-axis offset
Change the opacity between 1 and 0
Direction in which the text will be rendered.
Text rotation in radians
Shadow text configuration
Shadow text color
Shadow text offset in pixels
Shadow text opacity
Smoothing pixels (not recommended for bitmap fonts)
The text to render
The texture atlas configuration
Optional
charRange of characters covered by the component defined in number pairs. The default value is [32, 126, 161, 255], this means that the component will render characters from 32 to 126 and from 161 to 255.
Optional
fontThe size of the font in pixels for bitmap fonts.
Optional
spacing?: numberSpacing in pixels to correct badly sliced characters.
The width of the invisible box where the text is rendered
The TextRenderer component renders text to the screen with extensive customization options.
It supports both web-safe and imported fonts, but works optimally with bitmap fonts.
Under the hood, it generates a texture atlas containing all the characters needed for rendering.
The atlas generation can be configured with custom character ranges, font sizes, and spacing.
Text can be customized with font families, colors, sizing, orientation, shadows, letter spacing,
line height, opacity, smoothing, and positioning. The component allows text to be rotated,
flipped, and assigned to specific render layers.
Example
Example