1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #18119 from Snuffleupagus/issue-18117

Support charCodes larger than 32-bit in `adjustMapping` (issue 18117)
This commit is contained in:
Jonas Jenwald 2024-05-20 13:08:28 +02:00 committed by GitHub
commit db7e68aea8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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) {

View file

@ -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

Binary file not shown.

View file

@ -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",