Merge pull request #21491 from Snuffleupagus/readCmapTable-sort-last

Sort the mappings *last* in the `readCmapTable` function (PR 19321 follow-up)
This commit is contained in:
Jonas Jenwald 2026-06-23 16:01:09 +02:00 committed by GitHub
commit 813d1949ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
}; };
} }