Type

DrawTextOpt

: RenderProps & {

text

: string

The text to render.

font

?: string | FontData | Asset<FontData> | BitmapFontData | Asset<BitmapFontData>

The name of font to use.

size

?: number

The size of text (the height of each character).

align

?: TextAlign

Text alignment (default "left")

since v3000.0

width

?: number

The maximum width. Will wrap word around if exceed.

lineSpacing

?: number

The gap between each line (only available for bitmap fonts).

since v2000.2

letterSpacing

?: number

The gap between each character (only available for bitmap fonts).

since v2000.2

anchor

?: Anchor | Vec2

The anchor point, or the pivot point. Default to "topleft".

transform

?: CharTransform | CharTransformFunc

Transform the pos, scale, rotation or color for each character based on the index or char (only available for bitmap fonts).

since v2000.1

styles

?: Record<string, CharTransform | CharTransformFunc>

Stylesheet for styled chunks, in the syntax of "this is a [stylename]styled[/stylename] word" (only available for bitmap fonts).

since v2000.2

indentAll

?: boolean

If true, any (whitespace) indent on the first line of the paragraph will be copied to all of the lines for those parts that text-wrap.

}

How the text should look like.

group Draw

kaplay logo

Layer

Miscalenous