Don't duplicate the first entry in the charCodeToGlyphId map for CIDFontType2 fonts with a CIDToGIDMap that already mapped the first entry to a non-zero glyphId (issue 7544)

Fixes 7544.
This commit is contained in:
Jonas Jenwald 2016-08-16 12:23:53 +02:00
parent b112f9f9f4
commit 0b75f63c03
4 changed files with 12 additions and 1 deletions

View File

@ -2377,7 +2377,10 @@ var Font = (function FontClosure() {
charCodeToGlyphId[charCode] = glyphId; 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; charCodeToGlyphId[0] = numGlyphs - 1;
} }
} else { } else {

View File

@ -35,6 +35,7 @@
!issue7439.pdf !issue7439.pdf
!issue7446.pdf !issue7446.pdf
!issue7492.pdf !issue7492.pdf
!issue7544.pdf
!issue7598.pdf !issue7598.pdf
!filled-background.pdf !filled-background.pdf
!ArabicCIDTrueType.pdf !ArabicCIDTrueType.pdf

BIN
test/pdfs/issue7544.pdf Normal file

Binary file not shown.

View File

@ -1014,6 +1014,13 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{ "id": "issue7544",
"file": "pdfs/issue7544.pdf",
"md5": "87e3a9fc7d6a6c1bd5b53af6926ce48e",
"link": false,
"rounds": 1,
"type": "eq"
},
{ "id": "protectip", { "id": "protectip",
"file": "pdfs/protectip.pdf", "file": "pdfs/protectip.pdf",
"md5": "676e7a7b8f96d04825361832b1838a93", "md5": "676e7a7b8f96d04825361832b1838a93",