wrapWidths

Returns the width of each line a greedy word wrap at a width produces, measured in the face the text will be set in.

@internote/canvas-sdkFunction
On this page
import { wrapWidths } from '@internote/canvas-sdk';

A single word wider than the limit stands on its own line, overrunning, rather than being broken mid-word. Empty text gives no lines.

#Signature

(text: string, px: number, maxWidth: number, family?: string): number[]

#Parameters

text
The text to wrap.
px
The font size in pixels.
maxWidth
The width to wrap at, in pixels.
family
The CSS font stack.

Declared in packages/canvas-sdk/src/text/index.ts:133.

Last updated