The TextRenderer component allows to render text using font families, colors, and other configuration options.

  textRenderer.layer: "default";
textRenderer.text: "Hello world!";
textRenderer.font: "Arial";
textRenderer.fontSize: 16;
textRenderer.width: 160;
textRenderer.height: 16;
textRenderer.color: "#000000";
textRenderer.offset: new Vector2();
textRenderer.lineSeparation: 0;
textRenderer.letterSpacing: 0;
textRenderer.charRanges: [32, 126, 161, 255];
textRenderer.smooth: false;
textRenderer.rotation: 0;
textRenderer.opacity: 1;
textRenderer.orientation: TextOrientation.RightDown;
textRenderer.bitmapMargin: new Vector2();
textRenderer.bitmapSpacing: new Vector2();

Constructors

Properties

bitmapMargin: Vector2 = ...

Margin in pixels to correct badly sliced characters.

bitmapSpacing: Vector2 = ...

Spacing in pixels to correct badly sliced characters.

charRanges: number[] = ...

Range 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.

color: string = "#000000"

The text color

font: string | FontFace = "Arial"

The font family to use

fontSize: number = 16

The size of the font in pixels.

height: number = 16

The height of the invisible box where the text is rendered

layer: string = defaultRenderLayer

The render layer

letterSpacing: number = 0

The space between chars in pixels

lineSeparation: number = 0

The separation between lines in pixels

offset: Vector2 = ...

X-axis and Y-axis offset

opacity: number = 1

Change the opacity between 1 and 0

orientation: TextOrientation = TextOrientation.Center

Direction in which the text will be rendered.

rotation: number = 0

Text rotation in radians

smooth: boolean = false

Smoothing pixels (not recommended for bitmap fonts)

text: string = "Hello World!"

The text to render

width: number = 160

The width of the invisible box where the text is rendered