blockly > utils > dom > measureFontMetrics

utils.dom.measureFontMetrics() 函式

測量字型的指標。高度和基準值。

Signature:

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

參數

參數 類型 說明
text 字串 用於測量字型尺寸的文字。
fontSize 字串 要使用的字型大小。
fontWeight 字串 要使用的字型粗細。
fontFamily 字串 要使用的字型系列。

傳回:

{ height: 數字;基準:數字; }

字型測量。