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

Parameter Type Description
text string Text to measure the font dimensions of.
fontSize string The font size to use.
fontWeight string The font weight to use.
fontFamily string The font family to use.

Returns:

{ height: number; baseline: number; }

Font measurements.