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

Fixes reading Type1 FontBBox data for usWin values

This commit is contained in:
Yury Delendik 2013-11-01 11:33:30 -05:00
parent b34c6a4e02
commit 95d9107d8b
4 changed files with 29 additions and 6 deletions

View file

@ -5205,13 +5205,21 @@ var Type1Parser = (function Type1ParserClosure() {
for (var j = 0; j < size; j++) {
var token = this.getToken();
if (token === 'dup') {
var index = this.readInt();
this.getToken(); // read in '/'
var glyph = this.getToken();
encoding[index] = glyph;
this.getToken(); // read the in 'put'
// skipping till first dup or def (e.g. ignoring for statement)
while (token !== 'dup' && token !== 'def') {
token = this.getToken();
if (token === null) {
return; // invalid header
}
}
if (token === 'def') {
break; // read all array data
}
var index = this.readInt();
this.getToken(); // read in '/'
var glyph = this.getToken();
encoding[index] = glyph;
this.getToken(); // read the in 'put'
}
}
if (properties.overridableEncoding && encoding) {
@ -5219,6 +5227,13 @@ var Type1Parser = (function Type1ParserClosure() {
break;
}
break;
case 'FontBBox':
var fontBBox = this.readNumberArray();
// adjusting ascent/descent
properties.ascent = fontBBox[3];
properties.descent = fontBBox[1];
properties.ascentScaled = true;
break;
}
}
}