Use the real content of the string to measure it's size

This commit is contained in:
Vivien Nicolas 2011-06-23 05:38:05 +02:00
parent 57e7e798a6
commit b54164d2a9

4
pdf.js
View File

@ -2787,7 +2787,9 @@ var CanvasGraphics = (function() {
this.ctx.transform.apply(this.ctx, this.current.textMatrix);
this.ctx.scale(1, -1);
this.ctx.translate(0, -2 * this.current.y);
this.ctx.fillText(Fonts.charsToUnicode(text), this.current.x, this.current.y);
text = Fonts.charsToUnicode(text);
this.ctx.fillText(text, this.current.x, this.current.y);
this.current.x += this.ctx.measureText(text).width;
this.ctx.restore();