Browse Source

Add a comment for using unit-per-em in the measureText() method

Vivien Nicolas 14 years ago
parent
commit
a89e7331f4
  1. 4
      fonts.js

4
fonts.js

@ -155,7 +155,9 @@ var FontMeasure = (function FontMeasure() {
var charWidth = parseFloat(font.encoding[charcode].width); var charWidth = parseFloat(font.encoding[charcode].width);
width += charWidth; 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) { } catch(e) {
width = ctx.measureText(text).width / kScalePrecision; width = ctx.measureText(text).width / kScalePrecision;
} }

Loading…
Cancel
Save