【问题标题】:html5 canvas - How do I determine the width of a character?html5 canvas - 如何确定字符的宽度?
【发布时间】:2011-09-04 01:55:13
【问题描述】:

我正在使用具有固定宽度字体的.fillText。我可以通过设置.font来设置字体的高度。但是如何确定字符的最终宽度?

【问题讨论】:

    标签: javascript html canvas font-size


    【解决方案1】:

    尝试 measureText("a") 其中 a 是您要测量的字符。对于固定宽度的字体,应该都是一样的。

    【讨论】:

      猜你喜欢
      • 2012-04-23
      • 1970-01-01
      • 2013-11-09
      • 2022-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-05
      • 1970-01-01
      相关资源
      最近更新 更多