Skip to content

wrapText()

function wrapText(
text,
maxWidth,
font,
measurer,
wordWrap?
): string[];

Wraps text into lines that fit maxWidth points. Honours explicit line breaks, breaks at spaces, and splits words that are longer than a line. With wordWrap false only explicit line breaks are used.

Parameter Type Default value
text string undefined
maxWidth number undefined
font FontSpec undefined
measurer TextMeasurer undefined
wordWrap boolean true

string[]