1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 08:38:06 +02:00

Merge pull request #8747 from brendandahl/first-cmap

Fix two cmap related issues.
This commit is contained in:
Jonas Jenwald 2017-08-04 14:11:12 +02:00 committed by GitHub
commit ace9de6f7d
4 changed files with 18 additions and 5 deletions

View file

@ -1353,6 +1353,13 @@ var Font = (function FontClosure() {
var offset = font.getInt32() >>> 0;
var useTable = false;
// Sometimes there are multiple of the same type of table. Default
// to choosing the first table and skip the rest.
if (potentialTable && potentialTable.platformId === platformId &&
potentialTable.encodingId === encodingId) {
continue;
}
if (platformId === 0 && encodingId === 0) {
useTable = true;
// Continue the loop since there still may be a higher priority
@ -2393,11 +2400,9 @@ var Font = (function FontClosure() {
if (cmapMappings[i].charCode !== unicodeOrCharCode) {
continue;
}
if (hasGlyph(cmapMappings[i].glyphId)) {
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
found = true;
break;
}
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
found = true;
break;
}
if (!found && properties.glyphNames) {
// Try to map using the post table.