Closed Bug 1658975 Opened 4 years ago Closed 3 years ago

When browser.display.use_document_fonts=0, pdf.js missing some text

Categories

(Firefox :: PDF Viewer, defect)

79 Branch
Unspecified
All
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: nyanpasu64, Assigned: Snuffleupagus)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

55.77 KB, application/pdf
Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

Actual results:

Some text is missing. All text in Times/Arial Regular is present, and all text in bold/italic is missing.

If I open the PDF in Windows Okular, Times New Roman Regular and Arial Regular are embedded fonts and show up in pdf.js. Whereas the bold and italic variants use the system font in Okular, and are invisible in pdf.js.

Expected results:

All text is visible.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Graphics: Text
Product: Firefox → Core

I suspect this is a pdf.js issue rather than a core platform bug. Drawing text using the canvas2d fillText API (which is what pdf.js normally does) still works when use_document_fonts is disabled (although it'll appear via a generic fallback font rather than whatever was set on the canvas context).

But AFAICT pdf.js doesn't use the fillText method at all when use_document_fonts is turned off; presumably it detects this, knows that the rendering won't be reliable if it can't control the font, and takes an entirely different path (I suspect it's rasterizing glyphs itself from the font resources embedded in the PDF).

I guess this doesn't work with installed system fonts, only with PDF-embedded resources, probably because pdf.js doesn't have access to the actual font data for system fonts.

Component: Graphics: Text → PDF Viewer
Product: Core → Firefox

The severity field is not set for this bug.
:bdahl, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bdahl)
Severity: -- → S3
Flags: needinfo?(bdahl)
Attached file Test.pdf

I'm also seeing this in Firefox and Thunderbird. I searched several hours for the reason. It turned out the issue was, "browser.display.use_document_fonts" was set to 0.

I've attached a test file to reproduce this issue. First, set ("browser.display.use_document_fonts", 0) and then open this PDF in Firefox (or Thunderbird). I am seeing this on macOS. And Firefox 85.

The console shows several warnings like:

Warning: getPathGenerator - ignoring character: "Error: Requesting object that isn't resolved yet Helvetica_path_b.". pdf.js:1127:13

Status: UNCONFIRMED → NEW
Ever confirmed: true

I can reproduce the issue on Nightly87 Windows10.

#1 Regression window(forever spinning loading spinner):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5bf126434fac78a31256c994b9dbf4b1031b0350&tochange=c03413e3a8233d7ea0afff73717e1cdeae39fa49

Suspect: 7d8a99f5f75971f38acf666db47d178a7b47abf4 Brendan Dahl — Bug 1444499 - Update pdf.js to version 2.0.447. r=yury

#2 Partial fix window(font not rendered):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4432fb67de2d1e2658a36fed800979c1968c1f94&tochange=257c191e7903523a1132e04460a0b2460d950809

Suspect: 280327567bdf4ec76081a97c63dc1ec9f76550c7 Ryan VanderMeulen — Bug 1469362 - Update pdf.js to version 2.0.602. r=bdahl

Keywords: regression
OS: Unspecified → All
Regressed by: 1469362, 1444499
Has Regression Range: --- → yes

Fixed by
Bug 1718101 - Update pdf.js to version 2.10.199 r=calixte

Differential Revision: https://phabricator.services.mozilla.com/D118734

pushlog_url: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=b26c010f3c26ba2725f1089ae86f22d10c927940&tochange=976b92bb11db522804a44c9f66fc8f43dd7225e1

Works for me with Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0

One of the fixes in the pdf.js 2.10.199 update was

#13587 Set the default value of useSystemFonts correctly, depending on disableFontFace, in the API (PR 13516 follow-up)

which sounds like it was presumably the issue happening here.

Dup'ing to bug 1718101, where the fix landed.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE

(In reply to Jonathan Kew (:jfkthame) from comment #7)

Dup'ing to bug 1718101, where the fix landed.

*** This bug has been marked as a duplicate of bug 1718101 ***

We usually close the bugs as FIXED and mark them as depending on the PDF.js update.

Depends on: 1718101
Resolution: DUPLICATE → FIXED
Assignee: nobody → jonas.jenwald
See Also: → 1796997
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: