Closed Bug 1671312 Opened 4 years ago Closed 4 years ago

Font rendering glitch with pdf viewer

Categories

(Firefox :: PDF Viewer, defect)

defect

Tracking

()

RESOLVED FIXED
87 Branch

People

(Reporter: ekr, Unassigned)

References

Details

(Whiteboard: [pdfjs-d-font-conversion])

Attachments

(1 file)

1.37 MB, application/pdf
Details

See:

https://www.cityofpaloalto.org/civicax/filebank/documents/8700

In the upper right corner "Purposes' has bad kerning. This looks correct in Preview.

It looks like there are a few things going on here and we'll need a heuristic.

The font file is not embedded and font name is a non standard font name (not one of the 14 that can be used without embedding). However, an older version of the PDF spec maps this font name to one of the standard fonts. Even if the name is fixed, the font in the PDF specifies a widths array for the glyphs which we ignore for non-embedded fonts. If we don't ignore the widths then the PDF looks correct. Though then we get failures on other PDFs that don't embed the fonts.
To match acrobat we'll need to:

  1. add a map of non-standard to standard names
  2. use the widths array for a standard fonts
  3. ignore widths for non-standard fonts

FWIW, our current behavior matches pdfium.

Severity: -- → S3
Whiteboard: [pdfjs-d-font-conversion]

Hmmm... we're seeing something that might be related, with PDFs produced by a partner's software. (Regrettably, I can't provide a sample of the problem, as they all contain personal information.) The partner says, "oh, we don't support Firefox", so we're trying to find the problem and tell them how to produced PDFs that work for Firefox too. Suspecting that it is some kind of previously-ignored error or spec discrepancy/ambiguity, which it sounds like this might be.

In our case, a few particular fields on the PDF are displayed in a very small type instead of the expected large one. Same PDF shows the expected text in Chrome or Acrobat Reader. And it's definitely a recent change, as older generated PDFs behave the same way, and continue to look as expected in older Firefox (e.g. latest ESR).

Attached file badfont.pdf

Ok, I was able to get one of these failing PDFs generated with fake personal data, so I'm attaching it here. If this is an entirely different issue, I can open a new Bug

Hmmm, also, FWIW, having copied this file to a company Box.com location, the Box PDF preview does not exhibit this bad font behavior in the same Firefox that does exhibit it when opening directly.

Flags: needinfo?(bdahl)

Sorry, "needinfo" is clearly not what I should have done. But I would like to hear where this issue is. It's affecting our customers.

Flags: needinfo?(bdahl)

This PR:
https://github.com/mozilla/pdf.js/pull/12831
will help to fix the font size issue in annotations.

Status: NEW → RESOLVED
Closed: 4 years ago
Depends on: 1686102, 1691143
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
Depends on: 1691510
No longer depends on: 1691510
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: