Skip to content

Interface: TextMeasurer ​

Experimental

Low-level measuring backend: widths and vertical metrics at a font size of 1 px. Results are cached by the oracle, so implementations need not cache.

Properties ​

PropertyModifierTypeDescription
kindreadonlystringExperimental 'canvas', 'fallback', or a custom name (for debugging).

Methods ​

vertical() ​

ts
vertical(face): FontVerticalMetrics;

Experimental

Ascent/descent at 1 px.

Parameters ​

ParameterType
faceTextFace

Returns ​

FontVerticalMetrics


width() ​

ts
width(text, face): number;

Experimental

Advance width of a single line of text at 1 px.

Parameters ​

ParameterType
textstring
faceTextFace

Returns ​

number

Released under the MIT License.