Skip to content

Commit 5f5d9df

Browse files
committed
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.
1 parent 819671d commit 5f5d9df

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/core/evaluator.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4420,7 +4420,13 @@ class PartialEvaluator {
44204420

44214421
const fontNameStr = fontName?.name;
44224422
const baseFontStr = baseFont?.name;
4423-
if (!isType3Font && fontNameStr !== baseFontStr) {
4423+
if (isType3Font) {
4424+
if (!fontNameStr) {
4425+
// The Type3 font has a /FontDescriptor, however it's incomplete, hence
4426+
// why we didn't create a barbebones one above (fixes issue19954.pdf).
4427+
fontName = Name.get(type);
4428+
}
4429+
} else if (fontNameStr !== baseFontStr) {
44244430
info(
44254431
`The FontDescriptor's FontName is "${fontNameStr}" but ` +
44264432
`should be the same as the Font's BaseFont "${baseFontStr}".`

test/pdfs/issue19954.pdf.link

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/user-attachments/files/20281525/Capital.Bancorp.Inc.Corporate.Responsibility.2025509.SD000000003063823863-1-2.pdf

test/test_manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,6 +2859,15 @@
28592859
"rounds": 1,
28602860
"type": "eq"
28612861
},
2862+
{
2863+
"id": "issue19954",
2864+
"file": "pdfs/issue19954.pdf",
2865+
"md5": "9742309bb321691b53b96069dfc1099b",
2866+
"link": true,
2867+
"rounds": 1,
2868+
"lastPage": 1,
2869+
"type": "text"
2870+
},
28622871
{
28632872
"id": "IndexedCS_negative_and_high",
28642873
"file": "pdfs/IndexedCS_negative_and_high.pdf",

0 commit comments

Comments
 (0)