mcut
@mcut/compositor

layoutTextBlock

Generated TypeScript API reference for the public mcut SDK.

mcut SDK


mcut SDK / compositor/src / layoutTextBlock

Function: layoutTextBlock()

function layoutTextBlock(
   measure,
   text,
   style,
   options?): TextBlockLayout;

Defined in: packages/compositor/src/text.ts:246

Lay out a (possibly multi-line) text element. Lines come from explicit newlines only unless a text box width is provided.

Parameters

measure

MeasureFn

text

string

style

align

"left" | "center" | "right" = ...

backgroundColor?

string = ...

color

string = ...

fontFamily

string = ...

fontSize

number = ...

fontStyle

"normal" | "italic" = ...

fontWeight

number = ...

letterSpacing

number = ...

Extra space between characters in px (tracking).

lineHeight

number = ...

Line height as a multiple of fontSize.

shadow?

{ blur: number; color: string; offsetX: number; offsetY: number; } = ...

shadow.blur

number = ...

shadow.color

string = ...

Any CSS color (alpha encodes the strength).

shadow.offsetX

number = ...

shadow.offsetY

number = ...

stroke?

{ color: string; width: number; } = ...

stroke.color

string = ...

Any CSS color.

stroke.width

number = ...

Visible width in project px (frames paint it inside the bounds).

textTransform

"lowercase" | "uppercase" | "none" = ...

Case applied at render time; the stored text keeps the user's casing.

options?

TextBlockOptions = {}

Returns

TextBlockLayout

On this page