Browse Source

Fix loading of fonts with invalid encoding name entry (bug 859204 and 878112)

Jonas Jenwald 11 years ago
parent
commit
575bdd8863
  1. 12
      src/core/evaluator.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/bug859204.pdf
  4. 7
      test/test_manifest.json

12
src/core/evaluator.js

@ -858,7 +858,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} else if (isName(encoding)) { } else if (isName(encoding)) {
overridableEncoding = false; overridableEncoding = false;
hasEncoding = true; hasEncoding = true;
baseEncoding = Encodings[encoding.name]; var currentEncoding = Encodings[encoding.name];
// Some bad PDF files contain fonts whose encoding name is not among
// the predefined encodings, causing baseEncoding to be undefined.
// In this case, fallback to using the baseEncoding as defined above
// and let the font override the encoding if one is available.
if (currentEncoding) {
baseEncoding = currentEncoding;
} else {
overridableEncoding = true;
}
} else { } else {
error('Encoding is not a Name nor a Dict'); error('Encoding is not a Name nor a Dict');
} }

1
test/pdfs/.gitignore vendored

@ -64,3 +64,4 @@
!issue2956.pdf !issue2956.pdf
!bug946506.pdf !bug946506.pdf
!issue3885.pdf !issue3885.pdf
!bug859204.pdf

BIN
test/pdfs/bug859204.pdf

Binary file not shown.

7
test/test_manifest.json

@ -172,6 +172,13 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{ "id": "bug859204",
"file": "pdfs/bug859204.pdf",
"md5": "ac1ea1dbfa6ac9d5b13167483049af0b",
"link": false,
"rounds": 1,
"type": "eq"
},
{ "id": "issue1512", { "id": "issue1512",
"file": "pdfs/issue1512.pdf", "file": "pdfs/issue1512.pdf",
"md5": "41a19fe03d522346ee3baa732403fca4", "md5": "41a19fe03d522346ee3baa732403fca4",

Loading…
Cancel
Save