1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Always re-measure non-embedded ArialNarrow fonts (bug 1671312, PR 12725 follow-up)

While PR 12725 fixed bug 1671312 as reported, i.e. the "In the upper right corner "Purposes' has bad kerning."-part, it however broke other parts of the text rendering.
Note in particular the tables, e.g. on page 2 and beyond, where the glyphs are now rendered too close together. The reason for this is that the fonts in question are non-embedded ArialNarrow, which we just replace with Helvetica which obviously is not narrow. Given that the font replacement isn't a perfect fit for non-embedded ArialNarrow, we still need to re-measure the glyph widths in this case.
This commit is contained in:
Jonas Jenwald 2021-01-14 15:34:44 +01:00
parent dcd1589b2c
commit 2600e59acb
4 changed files with 106 additions and 1 deletions

View file

@ -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" &&