mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Removes duplicate entries after reading cmap table
This commit is contained in:
parent
b34c6a4e02
commit
bb2570c9c1
4 changed files with 18 additions and 1 deletions
|
@ -3077,6 +3077,17 @@ var Font = (function FontClosure() {
|
|||
error('cmap table has unsupported format: ' + format);
|
||||
}
|
||||
|
||||
// removing duplicate entries
|
||||
mappings.sort(function (a, b) {
|
||||
return a.charcode - b.charcode;
|
||||
});
|
||||
for (var i = 1; i < mappings.length; i++) {
|
||||
if (mappings[i - 1].charcode === mappings[i].charcode) {
|
||||
mappings.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
platformId: potentialTable.platformId,
|
||||
encodingId: potentialTable.encodingId,
|
||||
|
@ -3758,7 +3769,6 @@ var Font = (function FontClosure() {
|
|||
if (isTrueType) {
|
||||
var isGlyphLocationsLong = int16([tables.head.data[50],
|
||||
tables.head.data[51]]);
|
||||
|
||||
sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs,
|
||||
isGlyphLocationsLong, hintsValid, dupFirstEntry);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue