1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Support charCodes larger than 32-bit in adjustMapping (issue 18117)

This also required changing the initial `charCodeToGlyphId`-data to an Object, which seems generally correct since it's consistent with existing code in the `src\core\{cff_font, type1_font}.js` files.
This commit is contained in:
Jonas Jenwald 2024-05-20 12:00:42 +02:00
parent 63b66b412c
commit 440b4b6eeb
4 changed files with 17 additions and 3 deletions

View file

@ -484,8 +484,7 @@ function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
const isInPrivateArea = code =>
(PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1]) ||
(PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1]);
for (let originalCharCode in charCodeToGlyphId) {
originalCharCode |= 0;
for (const originalCharCode in charCodeToGlyphId) {
let glyphId = charCodeToGlyphId[originalCharCode];
// For missing glyphs don't create the mappings so the glyph isn't
// drawn.
@ -2834,7 +2833,7 @@ class Font {
data: createPostTable(properties),
};
const charCodeToGlyphId = [];
const charCodeToGlyphId = Object.create(null);
// Helper function to try to skip mapping of empty glyphs.
function hasGlyph(glyphId) {