Support Type3 fonts with an incomplete /FontDescriptor dictionary (issue 19954)

We have a fallback for the common case of Type3 fonts without a /FontDescriptor dictionary, however we also need to handle the case where it's present but lacking the required /FontName entry.
This commit is contained in:
Jonas Jenwald 2025-05-19 12:52:54 +02:00
parent 819671d42f
commit 5f5d9dfc28
3 changed files with 17 additions and 1 deletions

View File

@ -4420,7 +4420,13 @@ class PartialEvaluator {
const fontNameStr = fontName?.name;
const baseFontStr = baseFont?.name;
if (!isType3Font && fontNameStr !== baseFontStr) {
if (isType3Font) {
if (!fontNameStr) {
// The Type3 font has a /FontDescriptor, however it's incomplete, hence
// why we didn't create a barbebones one above (fixes issue19954.pdf).
fontName = Name.get(type);
}
} else if (fontNameStr !== baseFontStr) {
info(
`The FontDescriptor's FontName is "${fontNameStr}" but ` +
`should be the same as the Font's BaseFont "${baseFontStr}".`

View File

@ -0,0 +1 @@
https://github.com/user-attachments/files/20281525/Capital.Bancorp.Inc.Corporate.Responsibility.2025509.SD000000003063823863-1-2.pdf

View File

@ -2859,6 +2859,15 @@
"rounds": 1,
"type": "eq"
},
{
"id": "issue19954",
"file": "pdfs/issue19954.pdf",
"md5": "9742309bb321691b53b96069dfc1099b",
"link": true,
"rounds": 1,
"lastPage": 1,
"type": "text"
},
{
"id": "IndexedCS_negative_and_high",
"file": "pdfs/IndexedCS_negative_and_high.pdf",