Interface TextRendererOptions

interface TextRendererOptions {
    color: string;
    flipHorizontally: boolean;
    flipVertically: boolean;
    font: string | FontFace;
    fontSize: number;
    height: number;
    layer: string;
    letterSpacing: number;
    lineHeight: number;
    offset: Vector2;
    opacity: number;
    orientation: TextOrientation;
    rotation: number;
    shadow?: {
        color: string;
        offset: Vector2;
        opacity: number;
    };
    smooth: boolean;
    text: string;
    textureAtlas: {
        charRanges?: number[];
        fontSize?: number;
        spacing?: number;
    };
    width: number;
}

Properties

color: string

The text color

flipHorizontally: boolean

Flip the text horizontally

flipVertically: boolean

Flip the text vertically

font: string | FontFace

The font family to use

fontSize: number

The size of the font in pixels.

height: number

The height of the invisible box where the text is rendered

layer: string

The render layer

letterSpacing: number

The space between chars in pixels

lineHeight: number

The height of the line in pixels. Default value is equal to the font size

offset: Vector2

X-axis and Y-axis offset

opacity: number

Change the opacity between 1 and 0

orientation: TextOrientation

Direction in which the text will be rendered.

rotation: number

Text rotation in radians

shadow?: {
    color: string;
    offset: Vector2;
    opacity: number;
}

Shadow text configuration

Type declaration

  • color: string

    Shadow text color

  • offset: Vector2

    Shadow text offset in pixels

  • opacity: number

    Shadow text opacity

smooth: boolean

Smoothing pixels (not recommended for bitmap fonts)

text: string

The text to render

textureAtlas: {
    charRanges?: number[];
    fontSize?: number;
    spacing?: number;
}

The texture atlas configuration

Type declaration

  • OptionalcharRanges?: 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.

  • OptionalfontSize?: number

    The size of the font in pixels for bitmap fonts.

  • Optionalspacing?: number

    Spacing in pixels to correct badly sliced characters.

width: number

The width of the invisible box where the text is rendered