1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Use CMap in Type0 fonts when CFF is not a CID font

This commit is contained in:
Jani Pehkonen 2019-03-26 19:38:44 +02:00
parent 9b5a937f78
commit 49c6233fbc
4 changed files with 11 additions and 2 deletions

View file

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