diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 3a97ebbbe..209a58152 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1750,7 +1750,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // the differences array only contains adobe standard or symbol set names, // in pratice it seems better to always try to create a toUnicode // map based of the default encoding. - var toUnicode, charcode; + var toUnicode, charcode, glyphName; if (!properties.composite /* is simple font */) { toUnicode = []; var encoding = properties.defaultEncoding.slice(); @@ -1758,12 +1758,18 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // Merge in the differences array. var differences = properties.differences; for (charcode in differences) { - encoding[charcode] = differences[charcode]; + glyphName = differences[charcode]; + if (glyphName === '.notdef') { + // Skip .notdef to prevent rendering errors, e.g. boxes appearing + // where there should be spaces (fixes issue5256.pdf). + continue; + } + encoding[charcode] = glyphName; } var glyphsUnicodeMap = getGlyphsUnicode(); for (charcode in encoding) { // a) Map the character code to a character name. - var glyphName = encoding[charcode]; + glyphName = encoding[charcode]; // b) Look up the character name in the Adobe Glyph List (see the // Bibliography) to obtain the corresponding Unicode value. if (glyphName === '') { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index d0b08ac30..18459a896 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -13,6 +13,7 @@ !issue3214.pdf !issue4665.pdf !issue4684.pdf +!issue5256.pdf !issue5801.pdf !issue5946.pdf !issue5972.pdf diff --git a/test/pdfs/issue5256.pdf b/test/pdfs/issue5256.pdf new file mode 100644 index 000000000..f6d3cf249 Binary files /dev/null and b/test/pdfs/issue5256.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index ac342b40c..b15f03633 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1387,6 +1387,13 @@ "link": true, "type": "eq" }, + { "id": "issue5256", + "file": "pdfs/issue5256.pdf", + "md5": "9383e17ced31f9afc940fb7898df8e68", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "issue6360", "file": "pdfs/issue6360.pdf", "md5": "58c5455ffd84b1c07ad2d0fa90cd5e26",