Skip to main content

Home > blockly > utils > dom > measureFontMetrics

utils.dom.measureFontMetrics() function

Measure a font's metrics. The height and baseline values.

Signature:

export declare function measureFontMetrics(text: string, fontSize: string, fontWeight: string, fontFamily: string): {
height: number;
baseline: number;
};

Parameters

ParameterTypeDescription
textstringText to measure the font dimensions of.
fontSizestringThe font size to use.
fontWeightstringThe font weight to use.
fontFamilystringThe font family to use.

Returns:

{ height: number; baseline: number; }

Font measurements.