diff --git a/src/core/fonts.js b/src/core/fonts.js index add8fd973..39a74e2d0 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -3635,6 +3635,22 @@ var Type1Font = (function Type1FontClosure() { getGlyphMapping: function Type1Font_getGlyphMapping(properties) { var charstrings = this.charstrings; + + if (properties.composite) { + const charCodeToGlyphId = Object.create(null); + // Map CIDs directly to GIDs. + for ( + let glyphId = 0, charstringsLen = charstrings.length; + glyphId < charstringsLen; + glyphId++ + ) { + const charCode = properties.cMap.charCodeOf(glyphId); + // Add 1 because glyph 0 is duplicated. + charCodeToGlyphId[charCode] = glyphId + 1; + } + return charCodeToGlyphId; + } + var glyphNames = [".notdef"], glyphId; for (glyphId = 0; glyphId < charstrings.length; glyphId++) { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 648de4c34..a6ef9da6a 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -206,6 +206,7 @@ !bug1011159.pdf !issue5734.pdf !issue4875.pdf +!issue11740_reduced.pdf !issue4881.pdf !issue5994.pdf !issue6151.pdf diff --git a/test/pdfs/issue11740_reduced.pdf b/test/pdfs/issue11740_reduced.pdf new file mode 100644 index 000000000..069bf0514 Binary files /dev/null and b/test/pdfs/issue11740_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 9429ca6f9..73f94005e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -904,6 +904,12 @@ "link": false, "type": "eq" }, + { "id": "issue11740", + "file": "pdfs/issue11740_reduced.pdf", + "md5": "f3f2957f171af52229c6e749e8a5572b", + "rounds": 1, + "type": "eq" + }, { "id": "issue10491", "file": "pdfs/issue10491.pdf", "md5": "0759ec46739b13bb0b66170a18d33d4f",