|
|
@ -4121,13 +4121,18 @@ var Font = (function FontClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var charCodeToGlyphId = [], charCode, toUnicode = properties.toUnicode; |
|
|
|
var charCodeToGlyphId = [], charCode; |
|
|
|
|
|
|
|
var toUnicode = properties.toUnicode, widths = properties.widths; |
|
|
|
|
|
|
|
var isIdentityUnicode = toUnicode instanceof IdentityToUnicodeMap; |
|
|
|
|
|
|
|
|
|
|
|
function hasGlyph(glyphId, charCode) { |
|
|
|
function hasGlyph(glyphId, charCode, widthCode) { |
|
|
|
if (!missingGlyphs[glyphId]) { |
|
|
|
if (!missingGlyphs[glyphId]) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (charCode >= 0 && toUnicode.has(charCode)) { |
|
|
|
if (!isIdentityUnicode && charCode >= 0 && toUnicode.has(charCode)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (widths && widthCode >= 0 && isNum(widths[widthCode])) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -4147,7 +4152,7 @@ var Font = (function FontClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (glyphId >= 0 && glyphId < numGlyphs && |
|
|
|
if (glyphId >= 0 && glyphId < numGlyphs && |
|
|
|
hasGlyph(glyphId, charCode)) { |
|
|
|
hasGlyph(glyphId, charCode, cid)) { |
|
|
|
charCodeToGlyphId[charCode] = glyphId; |
|
|
|
charCodeToGlyphId[charCode] = glyphId; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -4208,7 +4213,7 @@ var Font = (function FontClosure() { |
|
|
|
var found = false; |
|
|
|
var found = false; |
|
|
|
for (i = 0; i < cmapMappingsLength; ++i) { |
|
|
|
for (i = 0; i < cmapMappingsLength; ++i) { |
|
|
|
if (cmapMappings[i].charCode === unicodeOrCharCode && |
|
|
|
if (cmapMappings[i].charCode === unicodeOrCharCode && |
|
|
|
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode)) { |
|
|
|
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode, -1)) { |
|
|
|
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; |
|
|
|
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; |
|
|
|
found = true; |
|
|
|
found = true; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -4218,7 +4223,7 @@ var Font = (function FontClosure() { |
|
|
|
// Try to map using the post table. There are currently no known
|
|
|
|
// Try to map using the post table. There are currently no known
|
|
|
|
// pdfs that this fixes.
|
|
|
|
// pdfs that this fixes.
|
|
|
|
var glyphId = properties.glyphNames.indexOf(glyphName); |
|
|
|
var glyphId = properties.glyphNames.indexOf(glyphName); |
|
|
|
if (glyphId > 0 && hasGlyph(glyphId, -1)) { |
|
|
|
if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) { |
|
|
|
charCodeToGlyphId[charCode] = glyphId; |
|
|
|
charCodeToGlyphId[charCode] = glyphId; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|