Add a comment for using unit-per-em in the measureText() method
This commit is contained in:
parent
0ea9411f69
commit
a89e7331f4
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…
x
Reference in New Issue
Block a user