Skip to content

Commit 835a456

Browse files
committed
Use adjustWidths unconditionally for all embedded fonts (issue 19802)
Previously we'd only do this for Type1/CFF fonts, see e.g. PR 6736, since the font-program may update the /FontMatrix. However, it seems that we should do this unconditionally to account for fonts with non-default /FontMatrix-entries in the font-dictionary (which seem to be pretty rare).
1 parent 539a81c commit 835a456

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/core/fonts.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,9 +1108,10 @@ class Font {
11081108
// Repair the TrueType file. It is can be damaged in the point of
11091109
// view of the sanitizer
11101110
data = this.checkAndRepair(name, file, properties);
1111-
if (this.isOpenType) {
1112-
adjustWidths(properties);
11131111

1112+
adjustWidths(properties);
1113+
1114+
if (this.isOpenType) {
11141115
type = "OpenType";
11151116
}
11161117
break;
@@ -2645,8 +2646,6 @@ class Font {
26452646
cffFile = new Stream(tables["CFF "].data);
26462647
cff = new CFFFont(cffFile, properties);
26472648

2648-
adjustWidths(properties);
2649-
26502649
return this.convert(name, cff, properties);
26512650
}
26522651

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
!checkbox-bad-appearance.pdf
2929
!issue4684.pdf
3030
!issue8092.pdf
31+
!issue19802.pdf
3132
!issue5256.pdf
3233
!issue5801.pdf
3334
!issue5946.pdf

test/pdfs/issue19802.pdf

41.4 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,6 +3871,13 @@
38713871
"annotations": true,
38723872
"about": "LinkAnnotation with a relative link, and a /Catalog Base-URI."
38733873
},
3874+
{
3875+
"id": "issue19802",
3876+
"file": "pdfs/issue19802.pdf",
3877+
"md5": "7a431fb7951ad605f676c80636bbe5d3",
3878+
"rounds": 1,
3879+
"type": "eq"
3880+
},
38743881
{
38753882
"id": "issue14824",
38763883
"file": "pdfs/issue14824.pdf",

0 commit comments

Comments
 (0)