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:
parent
63b66b412c
commit
440b4b6eeb
@ -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) {
|
||||
|
||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -242,6 +242,7 @@
|
||||
!ContentStreamNoCycleType3insideType3.pdf
|
||||
!ContentStreamCycleType3insideType3.pdf
|
||||
!issue2074.pdf
|
||||
!issue18117.pdf
|
||||
!scan-bad.pdf
|
||||
!issue13561_reduced.pdf
|
||||
!bug847420.pdf
|
||||
|
||||
BIN
test/pdfs/issue18117.pdf
Normal file
BIN
test/pdfs/issue18117.pdf
Normal file
Binary file not shown.
@ -5406,6 +5406,20 @@
|
||||
"lastPage": 2,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue18117",
|
||||
"file": "pdfs/issue18117.pdf",
|
||||
"md5": "0be6391f9910d807a0ded5e6913ff7e3",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue18117-text",
|
||||
"file": "pdfs/issue18117.pdf",
|
||||
"md5": "0be6391f9910d807a0ded5e6913ff7e3",
|
||||
"rounds": 1,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"id": "issue4890",
|
||||
"file": "pdfs/issue4890.pdf",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user