diff --git a/src/core/fonts.js b/src/core/fonts.js index 2c9ffa94e..ae9ced291 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -2377,7 +2377,10 @@ var Font = (function FontClosure() { charCodeToGlyphId[charCode] = glyphId; } }); - if (dupFirstEntry) { + if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) { + // We don't duplicate the first entry in the `charCodeToGlyphId` map + // if the font has a `CIDToGIDMap` which has already mapped the first + // entry to a non-zero `glyphId` (fixes issue7544.pdf). charCodeToGlyphId[0] = numGlyphs - 1; } } else { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 06486ca08..2852407f8 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -35,6 +35,7 @@ !issue7439.pdf !issue7446.pdf !issue7492.pdf +!issue7544.pdf !issue7598.pdf !filled-background.pdf !ArabicCIDTrueType.pdf diff --git a/test/pdfs/issue7544.pdf b/test/pdfs/issue7544.pdf new file mode 100644 index 000000000..8e030933a Binary files /dev/null and b/test/pdfs/issue7544.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 1d27162d4..866c3f540 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1014,6 +1014,13 @@ "rounds": 1, "type": "eq" }, + { "id": "issue7544", + "file": "pdfs/issue7544.pdf", + "md5": "87e3a9fc7d6a6c1bd5b53af6926ce48e", + "link": false, + "rounds": 1, + "type": "eq" + }, { "id": "protectip", "file": "pdfs/protectip.pdf", "md5": "676e7a7b8f96d04825361832b1838a93",