diff --git a/src/core/fonts.js b/src/core/fonts.js index 5dfbab374..d9bf1d6f0 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -4236,9 +4236,10 @@ var Font = (function FontClosure() { if (!glyphName) { continue; } - var unicodeOrCharCode; + var unicodeOrCharCode, isUnicode = false; if (cmapPlatformId === 3 && cmapEncodingId === 1) { unicodeOrCharCode = GlyphsUnicode[glyphName]; + isUnicode = true; } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { // TODO: the encoding needs to be updated with mac os table. unicodeOrCharCode = Encodings.MacRomanEncoding.indexOf(glyphName); @@ -4246,8 +4247,11 @@ var Font = (function FontClosure() { var found = false; for (i = 0; i < cmapMappingsLength; ++i) { - if (cmapMappings[i].charCode === unicodeOrCharCode && - hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode, -1)) { + if (cmapMappings[i].charCode !== unicodeOrCharCode) { + continue; + } + var code = isUnicode ? charCode : unicodeOrCharCode; + if (hasGlyph(cmapMappings[i].glyphId, code, -1)) { charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; found = true; break; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 0445acb12..9a9a81ab8 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -95,6 +95,7 @@ !issue5599.pdf !issue5747.pdf !issue6099.pdf +!issue6336.pdf !gradientfill.pdf !bug903856.pdf !bug850854.pdf diff --git a/test/pdfs/issue6336.pdf b/test/pdfs/issue6336.pdf new file mode 100644 index 000000000..5bfa8d168 Binary files /dev/null and b/test/pdfs/issue6336.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 06554677d..4fcb797dd 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1182,6 +1182,13 @@ "link": false, "type": "eq" }, + { "id": "issue6336", + "file": "pdfs/issue6336.pdf", + "md5": "1c457c12b3606e1de610235d6768bd78", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "issue5801", "file": "pdfs/issue5801.pdf", "md5": "e9548650ad40e13e00d2a486bbc2bb1b",