mcut
@mcut/compositor

layoutCaption

Generated TypeScript API reference for the public mcut SDK.

mcut SDK


mcut SDK / compositor/src / layoutCaption

Function: layoutCaption()

function layoutCaption(
   measure,
   element,
   style,
   maxWidth): CaptionLayout;

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

Greedily wrap caption words into centered lines no wider than maxWidth. Falls back to whitespace-split text when word timings are absent.

Parameters

measure

MeasureFn

element

text

string

words?

object[]

style

activeWordColor?

string = ...

Color applied to the word under the playhead (karaoke highlight).

backgroundColor

string = ...

color

string = ...

fontFamily

string = ...

fontSize

number = ...

fontWeight

number = ...

position

"top" | "middle" | "bottom" = ...

maxWidth

number

Returns

CaptionLayout

On this page