diff --git a/src/evaluator.js b/src/evaluator.js index 7e75ea904..1c41f8409 100644 --- a/src/evaluator.js +++ b/src/evaluator.js @@ -791,6 +791,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { }; } + var cidEncoding = baseDict.get('Encoding'); + if (isName(cidEncoding)) + properties.cidEncoding = cidEncoding.name; + var cidToGidMap = dict.get('CIDToGIDMap'); if (isStream(cidToGidMap)) properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); diff --git a/src/fonts.js b/src/fonts.js index 8177916cb..dda0c0df3 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -4126,6 +4126,15 @@ var Font = (function FontClosure() { } else cid++; } + + var cidEncoding = properties.cidEncoding; + if (cidEncoding && cidEncoding.indexOf('Uni') === 0) { + // input is already Unicode for Uni* CMap encodings. + // However, Unicode-to-CID conversion is needed + // regardless of the CMap encoding. So we can't reset + // unicodeToCID. + this.cidToUnicode = []; + } }, bindDOM: function Font_bindDOM() { @@ -4205,16 +4214,12 @@ var Font = (function FontClosure() { case 'CIDFontType0': if (this.noUnicodeAdaptation) { width = this.widths[this.unicodeToCID[charcode] || charcode]; - fontCharCode = mapPrivateUseChars(charcode); - break; } fontCharCode = this.toFontChar[charcode] || charcode; break; case 'CIDFontType2': if (this.noUnicodeAdaptation) { width = this.widths[this.unicodeToCID[charcode] || charcode]; - fontCharCode = mapPrivateUseChars(charcode); - break; } fontCharCode = this.toFontChar[charcode] || charcode; break; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 8b110cfe9..32c97bad7 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -37,3 +37,4 @@ !basicapi.pdf !mixedfonts.pdf !shading_extend.pdf +!noembed-identity.pdf diff --git a/test/pdfs/noembed-identity.pdf b/test/pdfs/noembed-identity.pdf new file mode 100644 index 000000000..a54233f68 Binary files /dev/null and b/test/pdfs/noembed-identity.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 62e5e2c01..cf28c369d 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -795,5 +795,11 @@ "md5": "9f11e815b485f7f0e1fa5c116c636cf9", "rounds": 1, "type": "eq" + }, + { "id": "noembed-identity", + "file": "pdfs/noembed-identity.pdf", + "md5": "05d3803b6c22451e18cb60d8d8c75c0c", + "rounds": 1, + "type": "eq" } ]