Skip to content

TextStyle

How a text looks (engine.text(string, style)). Texts are baked once into the atlas, and again only when the string or the style changes.

engine.text('0', { x: 40, y: 40, size: 48, align: 'left', outline: true })

optional size?: number

Font size, stage units.


optional font?: string

CSS font family list.


optional weight?: string | number

CSS font weight (default 700).


optional color?: string

CSS colour (default cream, #FBEFE3).


optional align?: "left" | "right" | "center"

‘left’: x is the start; ‘center’ (default); ‘right’: x is the end. y is always the middle of the line.


optional outline?: string | boolean

A dark outline (true: the default halo colour) of this width (stage units).


optional outlineWidth?: number

The outline’s width, stage units.


optional shadow?: string | boolean

A soft shadow (true: the default halo colour), blur in stage units.


optional shadowBlur?: number

The shadow’s blur radius, stage units.


optional bitmapFont?: string | BitmapFont

Draw with a bitmap font (its name, from engine.load or engine.bitmapFont, or the font): no bake per string, for texts that change often. size scales the font; the look (colour, outline) is the font’s, and tint multiplies it.