Merge pull request #21095 from calixteman/issue19634

Take into account CharProcs keys when computing the type3 hash
This commit is contained in:
calixteman 2026-04-13 16:09:21 +02:00 committed by GitHub
commit 96debf0c81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 0 deletions

View File

@ -4469,6 +4469,19 @@ class PartialEvaluator {
hash.update(cidToGidMap.peekBytes());
}
}
if (type.name === "Type3") {
// Type3 fonts with the same metrics/encoding but different CharProcs
// must not be aliased, since their glyphs may render completely
// differently (e.g. one font uses SMask glyph programs, another uses
// plain paths, see issue 19634).
const charProcs = baseDict.get("CharProcs");
if (charProcs instanceof Dict) {
for (const [key, entry] of charProcs.getRawEntries()) {
hash.update(entry instanceof Ref ? `${key}\0${entry}` : key);
}
}
}
}
return {

View File

@ -900,3 +900,4 @@
!issue7821.pdf
!issue21068.pdf
!recursiveCompositGlyf.pdf
!issue19634.pdf

BIN
test/pdfs/issue19634.pdf Normal file

Binary file not shown.

View File

@ -14112,5 +14112,12 @@
"md5": "e4e106d20e4af10d7a5f1a5da02db66f",
"rounds": 1,
"type": "eq"
},
{
"id": "issue19634",
"file": "pdfs/issue19634.pdf",
"md5": "ae33892db2a2421ec7c9c3e2aee07205",
"rounds": 1,
"type": "eq"
}
]