Small World Engine API Reference - v0.76.20
    Preparing search index...

    Interface TextTextureOptions

    Configuration options for a TextTexture.

    interface TextTextureOptions {
        align?: "left" | "right" | "center";
        background?: string;
        color?: string;
        fontFamily?: string;
        fontSize?: number;
        fontStretch?: string;
        fontUrl?: string;
        fontVariationSettings?: string;
        fontWeight?: number;
        gradient?: TextGradientOptions;
        italic?: boolean;
        letterSpacing?: number;
        lineHeight?: number;
        maxWidth?: number;
        outline?: TextOutlineOptions;
        padding?: number;
        pixelRatio?: number;
        shadow?: TextShadowOptions;
        text: string;
    }
    Index
    align?: "left" | "right" | "center"

    Horizontal text alignment. Defaults to "center".

    background?: string

    Background fill as a CSS color string, or "transparent". Defaults to "transparent".

    color?: string

    Fill color as a CSS color string. Defaults to "#ffffff". Ignored if gradient is set.

    fontFamily?: string

    CSS font family name. Defaults to "sans-serif".

    fontSize?: number

    Font size in pixels. Defaults to 48.

    fontStretch?: string

    CSS font-stretch value (keyword or percentage), drives the "wdth" axis of a variable font.

    fontUrl?: string

    URL of a font file (e.g. a variable font) to load and register under fontFamily before drawing.

    fontVariationSettings?: string

    Raw CSS font-variation-settings value for custom variable font axes beyond weight/stretch/ italic. Applied best-effort via CanvasRenderingContext2D.fontVariationSettings where the browser supports it; silently ignored otherwise.

    fontWeight?: number

    Numeric font weight, also drives the "wght" axis of a variable font. Defaults to 400.

    Linear gradient fill, replaces color.

    italic?: boolean

    Whether to render in italic, drives the "ital"/"slnt" axis of a variable font.

    letterSpacing?: number

    Extra spacing between characters in pixels.

    lineHeight?: number

    Line height multiplier relative to fontSize. Defaults to 1.2.

    maxWidth?: number

    Maximum line width in pixels before wrapping. Unset means no wrapping.

    Outline (stroke) effect.

    padding?: number

    Padding around the text in pixels. Defaults to 24.

    pixelRatio?: number

    Supersampling factor for a sharper texture. Defaults to 2.

    Drop-shadow effect.

    text: string

    The text to render. Explicit "\n" characters start a new line.