From a89e7331f437cbb30cbd8b18f2e121320bfc8d9a Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 9 Sep 2011 14:26:24 +0200 Subject: [PATCH] Add a comment for using unit-per-em in the measureText() method --- fonts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fonts.js b/fonts.js index 7d0062b6c..307393fa4 100755 --- a/fonts.js +++ b/fonts.js @@ -155,7 +155,9 @@ var FontMeasure = (function FontMeasure() { var charWidth = parseFloat(font.encoding[charcode].width); width += charWidth; } - width = width * size / 1000; + // XXX should use the unit-per-em value from the embedded font + var unitsPerEm = 1000; + width = width * size / unitsPerEm; } catch(e) { width = ctx.measureText(text).width / kScalePrecision; }