Skip to content

Commit

Permalink
Merge pull request #12861 from Snuffleupagus/bug-1671312-ArialNarrow
Browse files Browse the repository at this point in the history
Always re-measure non-embedded ArialNarrow fonts (bug 1671312, PR 12725 follow-up)
  • Loading branch information
timvandermeij authored Jan 14, 2021
2 parents dcd1589 + 2600e59 commit db70efa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,13 @@ var Font = (function FontClosure() {
// name ArialBlack for example will be replaced by Helvetica.
this.black = name.search(/Black/g) !== -1;

// Use 'name' instead of 'fontName' here because the original
// name ArialNarrow for example will be replaced by Helvetica.
const isNarrow = name.search(/Narrow/g) !== -1;

// if at least one width is present, remeasure all chars when exists
this.remeasure = !isStandardFont && Object.keys(this.widths).length > 0;
this.remeasure =
(!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
if (
(isStandardFont || isMappedToStandardFont) &&
type === "CIDFontType2" &&
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
!issue6889.pdf
!bug1001080.pdf
!bug1671312_reduced.pdf
!bug1671312_ArialNarrow.pdf
!issue6108.pdf
!issue6113.pdf
!openoffice.pdf
Expand Down
Binary file added test/pdfs/bug1671312_ArialNarrow.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,12 @@
"rounds": 1,
"type": "eq"
},
{ "id": "bug1671312_ArialNarrow",
"file": "pdfs/bug1671312_ArialNarrow.pdf",
"md5": "f4f0a0d1dc9276bd6e3402165ecdc3d7",
"rounds": 1,
"type": "eq"
},
{ "id": "issue7020",
"file": "pdfs/issue7020.pdf",
"md5": "93b464e21c649e64ae92eeafe99fc31b",
Expand Down

0 comments on commit db70efa

Please sign in to comment.