@mocanvas/mocanvas · interface

TextTextureSpec

interface TextTextureSpec

This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.


Properties · 14

align?: TextTextureAlign

@deprecated v5 renamed this to textAlign.

color: string

Any CSS color string.

fontFamily: string
fontSize: number
height: number
lineHeight: number

Unitless line-height multiplier.

maxWidth?: number

Soft-wrap width in page units. Omit for no wrapping (one line per paragraph).

padding?: number

Padding inside the box, in page units.

resolution: number

Device pixels per page unit the canvas is rasterized at, i.e. dpr × min(4, zoom). Callers bucket it to a power of two (bucketTextureResolution / editor.getTextureResolution()) so zooming does not re-rasterize every frame.

richText?: RichTextSource

The label as a rich-text document. When present the raster is drawn run by run, so bold, italic, underlined and struck-through spans keep their formatting on the GPU path rather than only in the DOM overlay.

text: string

The label as plain text. Ignored when TextTextureSpec.richText is set; derived from it when only richText is given.

textAlign?: TextTextureAlign

Horizontal alignment. Named align before v5; align is still accepted.

verticalAlign: TextTextureAlign
width: number

The box the texture covers, in page units — the shape's local geometry bounds.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.