diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 0ab0e524a..9b3f31167 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -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 { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 7d83280fe..7ba0239d7 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -900,3 +900,4 @@ !issue7821.pdf !issue21068.pdf !recursiveCompositGlyf.pdf +!issue19634.pdf diff --git a/test/pdfs/issue19634.pdf b/test/pdfs/issue19634.pdf new file mode 100644 index 000000000..cc5d38773 Binary files /dev/null and b/test/pdfs/issue19634.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 992ad54aa..d83e9e493 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -14112,5 +14112,12 @@ "md5": "e4e106d20e4af10d7a5f1a5da02db66f", "rounds": 1, "type": "eq" + }, + { + "id": "issue19634", + "file": "pdfs/issue19634.pdf", + "md5": "ae33892db2a2421ec7c9c3e2aee07205", + "rounds": 1, + "type": "eq" } ]