From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 9 Sep 2011 12:26:24 +0000 (+0200) Subject: Add a comment for using unit-per-em in the measureText() method X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a89e7331f437cbb30cbd8b18f2e121320bfc8d9a;p=pdf.js.git Add a comment for using unit-per-em in the measureText() method --- diff --git a/fonts.js b/fonts.js index 7d0062b..307393f 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; }