在 canvas 中,TextMetrics 接口表示文本的尺寸,通过 CanvasRenderingContext2D.measureText() 方法创建。
Object.prototype
 Function.prototype 
  TextMetrics
程序不能直接调用该构造函数,否则将会产生异常。
| 属性 | 说明 | 
|---|---|
| - | - | 
| 语法 | 说明 | 
|---|---|
| - | - | 
Object.prototype
 TextMetrics.prototype
| 属性 | 说明 | 
|---|---|
| width | 只读,double 类型,使用 CSS 像素计算的内联字符串的宽度。基于当前上下文字体考虑。 | 
| actualBoundingBoxLeft | 只读,double 类型,平行于基线,从 CanvasRenderingContext2D.textAlign 属性确定的对齐点到文本矩形边界左侧的距离,使用 CSS 像素计算。 | 
| actualBoundingBoxRight | 只读,double 类型,平行于基线,从 CanvasRenderingContext2D.textAlign 属性确定的对齐点到文本矩形边界右侧的距离,使用 CSS 像素计算。 | 
| fontBoundingBoxAscent | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到渲染文本的所有字体的矩形最高边界顶部的距离,使用 CSS 像素计算。 | 
| fontBoundingBoxDescent | 只读,double 类型,根据从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到渲染文本的所有字体的矩形边界顶部的距离,使用 CSS 像素计算。 | 
| actualBoundingBoxAscent | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到渲染文本的矩形边界顶部的距离,使用 CSS 像素计算。 | 
| actualBoundingBoxDescent | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到渲染文本的矩形边界底部的距离,使用 CSS 像素计算。 | 
| emHeightAscent | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到线框中 em 方块顶部的距离,使用 CSS 像素计算。 | 
| emHeightDescent | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到线框中 em 方块底部的距离,使用 CSS 像素计算。 | 
| hangingBaseline | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到线框的 hanging 基线的距离,使用 CSS 像素计算。 | 
| alphabeticBaseline | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到线框的 alphabetic 基线的距离,使用 CSS 像素计算。 | 
| ideographicBaseline | 只读,double 类型,从 CanvasRenderingContext2D.textBaseline 属性标明的水平线到线框的 ideographic 基线的距离,使用 CSS 像素计算。 | 
| 语法 | 说明 | 
|---|---|
| - | - | 
Object.prototype
 TextMetrics.prototype
  TextMetrics 实例