blockly > utils > dom > measureFontMetrics

utils.dom.measureFontMetrics() 函数

衡量字体的指标。高度和基线值。

Signature:

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

参数

参数 类型 说明
PLAIN_TAXT; string 测量字体尺寸的文本。
fontSize string 要使用的字体大小。
fontWeight string 要使用的字体粗细。
fontFamily string 要使用的字体系列。

返回

{ height: 数字; 基准: 数字; }

字体测量。