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

View File

@ -29,6 +29,7 @@
!TAMReview.pdf !TAMReview.pdf
!issue918.pdf !issue918.pdf
!issue1905.pdf !issue1905.pdf
!issue2833.pdf
!rotated.pdf !rotated.pdf
!issue1249.pdf !issue1249.pdf
!smaskdim.pdf !smaskdim.pdf

BIN
test/pdfs/issue2833.pdf Normal file

Binary file not shown.

View File

@ -33,6 +33,13 @@
"type": "load", "type": "load",
"about": "PDF with undefined stream length." "about": "PDF with undefined stream length."
}, },
{ "id": "issue2833",
"file": "pdfs/issue2833.pdf",
"md5": "7bc6e17c41586155c188d7408bcb9ab5",
"rounds": 1,
"lastPage": 1,
"type": "eq"
},
{ "id": "issue2881", { "id": "issue2881",
"file": "pdfs/issue2881.pdf", "file": "pdfs/issue2881.pdf",
"md5": "ea6ade27d2cb146676d23dcd6605d5ee", "md5": "ea6ade27d2cb146676d23dcd6605d5ee",