Browse Source

Merge pull request #3873 from yurydelendik/issu2833

Fixes reading Type1 FontBBox data for usWin values
Brendan Dahl 12 years ago
parent
commit
768a86d59d
  1. 19
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue2833.pdf
  4. 7
      test/test_manifest.json

19
src/core/fonts.js

@ -5205,7 +5205,16 @@ var Type1Parser = (function Type1ParserClosure() { @@ -5205,7 +5205,16 @@ var Type1Parser = (function Type1ParserClosure() {
for (var j = 0; j < size; j++) {
var token = this.getToken();
if (token === 'dup') {
// 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();
@ -5213,12 +5222,18 @@ var Type1Parser = (function Type1ParserClosure() { @@ -5213,12 +5222,18 @@ var Type1Parser = (function Type1ParserClosure() {
this.getToken(); // read the in 'put'
}
}
}
if (properties.overridableEncoding && encoding) {
properties.baseEncoding = encoding;
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

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

BIN
test/pdfs/issue2833.pdf

Binary file not shown.

7
test/test_manifest.json

@ -33,6 +33,13 @@ @@ -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…
Cancel
Save