]> git.parisson.com Git - pdf.js.git/commitdiff
Add a comment for using unit-per-em in the measureText() method
authorVivien Nicolas <21@vingtetun.org>
Fri, 9 Sep 2011 12:26:24 +0000 (14:26 +0200)
committerVivien Nicolas <21@vingtetun.org>
Fri, 9 Sep 2011 12:26:24 +0000 (14:26 +0200)
fonts.js

index 7d0062b6c7d834ba8ffc448496fdad11fe64e1ee..307393fa489cc93b1fbbeefb627d9d3b1a4547cb 100755 (executable)
--- 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;
       }