Skip to content

Function: createCanvasTextMeasurer() ​

ts
function createCanvasTextMeasurer(): TextMeasurer | null;

Experimental

Canvas 2D measurer, or null when no canvas with a 2D context exists (node, jsdom without the canvas package). Vertical metrics come from fontBoundingBoxAscent/Descent (the font's line metrics) and fall back to Arial-like ratios where unsupported.

Returns ​

TextMeasurer | null

Released under the MIT License.