Browse Source

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.
Jonas Jenwald 9 years ago
parent
commit
0b75f63c03
  1. 5
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue7544.pdf
  4. 7
      test/test_manifest.json

5
src/core/fonts.js

@ -2377,7 +2377,10 @@ var Font = (function FontClosure() { @@ -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 {

1
test/pdfs/.gitignore vendored

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

BIN
test/pdfs/issue7544.pdf

Binary file not shown.

7
test/test_manifest.json

@ -1014,6 +1014,13 @@ @@ -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",

Loading…
Cancel
Save