1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Read the text matrix from the Type1 font ascii header

This commit is contained in:
Vivien Nicolas 2011-07-01 07:16:56 +02:00
parent ae2d130f40
commit e13164eca6
2 changed files with 66 additions and 5 deletions

6
pdf.js
View file

@ -3544,7 +3544,8 @@ var CanvasGraphics = (function() {
capHeight: descriptor.get("CapHeight"),
flags: descriptor.get("Flags"),
italicAngle: descriptor.get("ItalicAngle"),
fixedPitch: false
fixedPitch: false,
textMatrix: IDENTITY_MATRIX.slice()
};
return {
@ -3861,7 +3862,6 @@ var CanvasGraphics = (function() {
// TODO: apply charSpacing, wordSpacing, textHScale
this.ctx.save();
this.ctx.transform.apply(this.ctx, this.current.textMatrix);
this.ctx.scale(1, -1);
if (this.ctx.$showText) {
@ -3869,6 +3869,8 @@ var CanvasGraphics = (function() {
} else {
text = Fonts.charsToUnicode(text);
this.ctx.translate(this.current.x, -1 * this.current.y);
var matrix = Fonts.lookup(this.current.fontName).properties.textMatrix;
this.ctx.transform.apply(this.ctx, matrix);
this.ctx.fillText(text, 0, 0);
this.current.x += Fonts.measureText(text);
}