diff --git a/src/core/fonts.js b/src/core/fonts.js index cbba35ed6b641..f4d00ae8d6840 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -3438,19 +3438,21 @@ var CFFFont = (function CFFFontClosure() { if (properties.composite) { charCodeToGlyphId = Object.create(null); + let charCode; if (cff.isCIDFont) { // If the font is actually a CID font then we should use the charset // to map CIDs to GIDs. for (glyphId = 0; glyphId < charsets.length; glyphId++) { var cid = charsets[glyphId]; - var charCode = properties.cMap.charCodeOf(cid); + charCode = properties.cMap.charCodeOf(cid); charCodeToGlyphId[charCode] = glyphId; } } else { // If it is NOT actually a CID font then CIDs should be mapped // directly to GIDs. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { - charCodeToGlyphId[glyphId] = glyphId; + charCode = properties.cMap.charCodeOf(glyphId); + charCodeToGlyphId[charCode] = glyphId; } } return charCodeToGlyphId; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 259a957104a47..bba8eca653a92 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -241,6 +241,7 @@ !bug1151216.pdf !bug1175962.pdf !bug1020226.pdf +!issue9534_reduced.pdf !basicapi.pdf !issue2884_reduced.pdf !mixedfonts.pdf diff --git a/test/pdfs/issue9534_reduced.pdf b/test/pdfs/issue9534_reduced.pdf new file mode 100644 index 0000000000000..c892e4402c739 Binary files /dev/null and b/test/pdfs/issue9534_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index c188d388e798a..4d94fd54835e4 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2718,6 +2718,12 @@ "link": true, "type": "eq" }, + { "id": "issue9534_reduced", + "file": "pdfs/issue9534_reduced.pdf", + "md5": "f9a47805555de5bc0f9f5f5188df6bad", + "rounds": 1, + "type": "eq" + }, { "id": "issue1233", "file": "pdfs/issue1233.pdf", "md5": "2d3565b0a286e29955796c37c66326c1",