1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 01:28:06 +02:00

backout font measurement change, it is breaking tests

This commit is contained in:
Andreas Gal 2011-07-08 18:51:20 -07:00
parent 5bf4fcba9b
commit f2a4756c77
2 changed files with 39 additions and 42 deletions

13
pdf.js
View file

@ -3972,6 +3972,7 @@ var CanvasGraphics = (function() {
this.ctx.$setFont(fontName, size);
} else {
this.ctx.font = size + 'px "' + fontName + '"';
Fonts.setActive(fontName, fontObj, size);
}
},
setTextRenderingMode: function(mode) {
@ -4017,14 +4018,16 @@ var CanvasGraphics = (function() {
ctx.$showText(current.y, text);
} else {
ctx.translate(current.x, -1 * current.y);
var font = current.font;
ctx.transform.apply(ctx, font.textMatrix);
text = font.charsToUnicode(text);
var font = this.current.font;
if (font) {
ctx.transform.apply(ctx, font.textMatrix);
text = font.charsToUnicode(text);
}
ctx.fillText(text, 0, 0);
current.x += font.measureText(text, current.fontSize);
current.x += Fonts.measureText(text);
}
ctx.restore();
this.ctx.restore();
},
showSpacedText: function(arr) {
for (var i = 0; i < arr.length; ++i) {