Merge pull request #3873 from yurydelendik/issu2833
Fixes reading Type1 FontBBox data for usWin values
This commit is contained in:
commit
768a86d59d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -29,6 +29,7 @@
|
||||
!TAMReview.pdf
|
||||
!issue918.pdf
|
||||
!issue1905.pdf
|
||||
!issue2833.pdf
|
||||
!rotated.pdf
|
||||
!issue1249.pdf
|
||||
!smaskdim.pdf
|
||||
|
BIN
test/pdfs/issue2833.pdf
Normal file
BIN
test/pdfs/issue2833.pdf
Normal file
Binary file not shown.
@ -33,6 +33,13 @@
|
||||
"type": "load",
|
||||
"about": "PDF with undefined stream length."
|
||||
},
|
||||
{ "id": "issue2833",
|
||||
"file": "pdfs/issue2833.pdf",
|
||||
"md5": "7bc6e17c41586155c188d7408bcb9ab5",
|
||||
"rounds": 1,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue2881",
|
||||
"file": "pdfs/issue2881.pdf",
|
||||
"md5": "ea6ade27d2cb146676d23dcd6605d5ee",
|
||||
|
Loading…
Reference in New Issue
Block a user