Merge pull request #10683 from janpe2/type0-noncid-cmap

Use CMap in Type0 fonts when CFF is not a CID font
This commit is contained in:
Tim van der Meij 2019-03-28 00:07:08 +01:00 committed by GitHub
commit f9c58115fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View File

@ -3438,19 +3438,21 @@ var CFFFont = (function CFFFontClosure() {
if (properties.composite) { if (properties.composite) {
charCodeToGlyphId = Object.create(null); charCodeToGlyphId = Object.create(null);
let charCode;
if (cff.isCIDFont) { if (cff.isCIDFont) {
// If the font is actually a CID font then we should use the charset // If the font is actually a CID font then we should use the charset
// to map CIDs to GIDs. // to map CIDs to GIDs.
for (glyphId = 0; glyphId < charsets.length; glyphId++) { for (glyphId = 0; glyphId < charsets.length; glyphId++) {
var cid = charsets[glyphId]; var cid = charsets[glyphId];
var charCode = properties.cMap.charCodeOf(cid); charCode = properties.cMap.charCodeOf(cid);
charCodeToGlyphId[charCode] = glyphId; charCodeToGlyphId[charCode] = glyphId;
} }
} else { } else {
// If it is NOT actually a CID font then CIDs should be mapped // If it is NOT actually a CID font then CIDs should be mapped
// directly to GIDs. // directly to GIDs.
for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
charCodeToGlyphId[glyphId] = glyphId; charCode = properties.cMap.charCodeOf(glyphId);
charCodeToGlyphId[charCode] = glyphId;
} }
} }
return charCodeToGlyphId; return charCodeToGlyphId;

View File

@ -242,6 +242,7 @@
!bug1151216.pdf !bug1151216.pdf
!bug1175962.pdf !bug1175962.pdf
!bug1020226.pdf !bug1020226.pdf
!issue9534_reduced.pdf
!basicapi.pdf !basicapi.pdf
!issue2884_reduced.pdf !issue2884_reduced.pdf
!mixedfonts.pdf !mixedfonts.pdf

Binary file not shown.

View File

@ -2725,6 +2725,12 @@
"link": true, "link": true,
"type": "eq" "type": "eq"
}, },
{ "id": "issue9534_reduced",
"file": "pdfs/issue9534_reduced.pdf",
"md5": "f9a47805555de5bc0f9f5f5188df6bad",
"rounds": 1,
"type": "eq"
},
{ "id": "issue1233", { "id": "issue1233",
"file": "pdfs/issue1233.pdf", "file": "pdfs/issue1233.pdf",
"md5": "2d3565b0a286e29955796c37c66326c1", "md5": "2d3565b0a286e29955796c37c66326c1",