mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-27 17:37:22 +02:00
Sort the mappings *last* in the readCmapTable function (PR 19321 follow-up)
This improves performance of `issue19319.pdf` even more, and locally the rendering time of the second page goes from ~300 ms to ~250 ms, since we avoid sorting a bunch of duplicate entries.
This commit is contained in:
parent
d71fe9025d
commit
9ca13c9a23
@ -1860,7 +1860,6 @@ class Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// removing duplicate entries
|
// removing duplicate entries
|
||||||
mappings.sort((a, b) => a.charCode - b.charCode);
|
|
||||||
const finalMappings = [],
|
const finalMappings = [],
|
||||||
seenCharCodes = new Set();
|
seenCharCodes = new Set();
|
||||||
for (const map of mappings) {
|
for (const map of mappings) {
|
||||||
@ -1876,7 +1875,7 @@ class Font {
|
|||||||
return {
|
return {
|
||||||
platformId: potentialTable.platformId,
|
platformId: potentialTable.platformId,
|
||||||
encodingId: potentialTable.encodingId,
|
encodingId: potentialTable.encodingId,
|
||||||
mappings: finalMappings,
|
mappings: finalMappings.sort((a, b) => a.charCode - b.charCode),
|
||||||
hasShortCmap,
|
hasShortCmap,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user