diff --git a/src/core/type1_parser.js b/src/core/type1_parser.js index ad35fa768..d87c7986d 100644 --- a/src/core/type1_parser.js +++ b/src/core/type1_parser.js @@ -679,13 +679,19 @@ var Type1Parser = (function Type1ParserClosure() { // here and put an endchar to make the validator happy. output = [14]; } - program.charstrings.push({ + const charStringObject = { glyphName: glyph, charstring: output, width: charString.width, lsb: charString.lsb, seac: charString.seac, - }); + }; + if (glyph === ".notdef") { + // Make sure .notdef is at index zero (issue #11477). + program.charstrings.unshift(charStringObject); + } else { + program.charstrings.push(charStringObject); + } // Attempt to replace missing widths, from the font dictionary /Widths // entry, with ones from the font data (fixes issue11150_reduced.pdf). diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index d2db531b2..9b7b4ee8a 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -299,6 +299,7 @@ !issue4573.pdf !issue4722.pdf !issue4800.pdf +!issue11477_reduced.pdf !text_clip_cff_cid.pdf !issue4801.pdf !issue5334.pdf diff --git a/test/pdfs/issue11477_reduced.pdf b/test/pdfs/issue11477_reduced.pdf new file mode 100644 index 000000000..d0abc3771 Binary files /dev/null and b/test/pdfs/issue11477_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 71c4bafe3..1493f4d9b 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1456,6 +1456,12 @@ "rounds": 1, "type": "eq" }, + { "id": "issue11477", + "file": "pdfs/issue11477_reduced.pdf", + "md5": "f4e5735569afce79e52b3fd56d10ae13", + "rounds": 1, + "type": "eq" + }, { "id": "issue7665", "file": "pdfs/issue7665.pdf", "md5": "f1199d16195a61e8232e2d1e742ed46b",