@mocanvas/mocanvas · function

wrapTextTextureLines

declare function wrapTextTextureLines(spec: TextTextureSpec): string[]

Break spec.text into the lines the label renders as: hard newlines always, plus greedy word wrapping at maxWidth (breaking inside a word only when a single word does not fit), mirroring overflow-wrap: break-word. Unlike the SVG exporter's wrapTextLines, widths come from the shared TextMeasure, so the raster matches the DOM label it replaces.

Mentioned here

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.