pdf.js should render pages correctly even when browser.display.use_document_fonts=0

RESOLVED FIXED in Firefox 24

Status

()

Firefox
PDF Viewer
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: Octoploid, Unassigned)

Tracking

Trunk
Firefox 24
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [pdfjs-c-ff-integration])

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0a1
Build ID: 20120323140525

Steps to reproduce:

pdf.js should render pages correctly even when browser.display.use_document_fonts=0.



Actual results:

pdf.js tries to use the default font when rendering pages
which results in unreadable text.


Expected results:

pdf.js should use the embedded fonts of the pdf, even when 
browser.display.use_document_fonts is disabled.
(Reporter)

Updated

6 years ago
Component: Untriaged → PDF Viewer

Updated

6 years ago
QA Contact: untriaged → pdf-viewer
Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120625 Firefox/15.0a2

Confirming that writing is not properly formatted with browser.display.use_document_fonts=0: font changes and spacing between characters is variable.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: x86_64 → All

Comment 2

6 years ago
Yes, I think we need to override the browser setting. It hasn't been fixed yet.

Updated

6 years ago
Whiteboard: [pdfjs-c-ux]

Updated

6 years ago
Whiteboard: [pdfjs-c-ux] → [pdfjs-c-ff-integration]
We shall not override the user's decision to not use documents fonts even if it's a PDF document; e.g. if the user too cautious about security of web fonts, usage of the fonts from PDF that was loaded from the remote source will not make him comfortable to. Am I missing something?

Currently, we show the warning bar and output the warning messages to the error console when use_document_fonts=0 is set.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WONTFIX

Comment 4

5 years ago
Yes, you are missing many things: I do not use document fonts for *HTML* pages because they usually render with a better quality with my own choices. And HTML pages are based on Unicode, so that not using the document fonts won't make a page unreadable. For PDF, this is completely the opposite: special characters (e.g. in math formulas) are specific to the PDF file, so that the font in the PDF MUST be used (I suppose that this is in the PDF spec), otherwise the PDF is unreadable; moreover even with standard characters, if a font is replaced by another one in a PDF, the rendering can be ugly because a part of the layout has already been done (this is not the case with HTML).

Another difference: With PDF, you don't have the choice: the fonts are necessarily downloaded with the file. With HTML, you can avoid that, e.g. with slow connections or if you are paying for communication (e.g. via GSM).

Comment 5

5 years ago
And if the user doesn't want to use the fonts from the PDF document (but who would want that? Most PDF viewers don't even offer such a choice), a new config option could be introduced for this purpose.

Updated

5 years ago
Duplicate of this bug: 850579

Comment 7

5 years ago
Since the problem comes from the fact that there is a single option to control the use of document fonts (see comment #3), I've opened bug 851369 to ask for a split of the option. Without this, for users who want to disable document fonts for HTML pages, using the PDF Viewer would be impracticable as many PDF files would be unreadable.

Comment 8

5 years ago
This bug should be re-opened. It makes no sense for the custom fonts setting to apply to PDF documents as well as web page content.

(In reply to Yury Delendik (:yury) from comment #3)
> Currently, we show the warning bar and output the warning messages to the
> error console when use_document_fonts=0 is set.

I don't see any warning bar.

Comment 9

5 years ago
I agree that it would be much better to re-open this bug.

And when I tried, I didn't see any warning bar either. But a warning bar wouldn't have helped (except for identifying the exact problem) since I set browser.display.use_document_fonts=0 on purpose (for HTML pages only).

BTW, if someone really cares about security to the point of disabling document fonts, he should probably disable Javascript too (where security problems are more likely to occur), in which case pdf.js wouldn't run. So, even for security, I don't think there's any problem to ignore use_document_fonts with pdf.js.
(Reporter)

Updated

5 years ago
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

Updated

5 years ago
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → WONTFIX
I don't see any reason why it was re-opened
(In reply to mjh563 from comment #8)
> This bug should be re-opened. It makes no sense for the custom fonts setting
> to apply to PDF documents as well as web page content.
> 
> (In reply to Yury Delendik (:yury) from comment #3)
> > Currently, we show the warning bar and output the warning messages to the
> > error console when use_document_fonts=0 is set.
> 
> I don't see any warning bar.

Looks like it is bug 852530. Notification is visible for other platforms

Comment 12

5 years ago
(In reply to Yury Delendik (:yury) from comment #10)
> I don't see any reason why it was re-opened

Other users could say that they don't see any reason why it was closed.

Do you have any evidence that some users choose to set browser.display.use_document_fonts=0 for security reasons while not disabling Javascript (or just pdf.js)?

Is there any reason why users would fear security problems with Firefox font handling while most external PDF viewers always use the fonts from the PDF documents?
(In reply to Vincent Lefevre from comment #12)
> (In reply to Yury Delendik (:yury) from comment #10)
> > I don't see any reason why it was re-opened
> 
> Other users could say that they don't see any reason why it was closed.
> 
> Do you have any evidence that some users choose to set
> browser.display.use_document_fonts=0 for security reasons while not
> disabling Javascript (or just pdf.js)?
> 
> Is there any reason why users would fear security problems with Firefox font
> handling while most external PDF viewers always use the fonts from the PDF
> documents?

http://web.nvd.nist.gov/view/vuln/search-results?query=font&search_type=all&cves=on
Vincent,

If you insist on "prettier web page" purpose of setting use_document_fonts=0, then I can suggest a workaround: read http://www-archive.mozilla.org/unix/customizing.html, userContent.css will let you change fonts of the content (even per domain if you want).

As a user I would expect that if I force browser not to use fonts it shall be used for any document Firefox renders (HTML or PDF). Corporate network administrators would expect the same thing.

Comment 15

5 years ago
(In reply to Yury Delendik (:yury) from comment #14)
> As a user I would expect that if I force browser not to use fonts it shall
> be used for any document Firefox renders (HTML or PDF). Corporate network
> administrators would expect the same thing.

I wouldn't expect that. To me, PDF documents are entirely separate from HTML content, and should be treated as such.

(I guess 'normal' users might not understand the difference, especially if their PDFs always open in the browser rather than an external viewer. But nonetheless, they are fundamentally different content types.)

Personally, the reason I use my own font choice is not for security, but simply because I find it easier to read than the default font that many sites use. But I certainly don't expect that font to be applied to PDFs too, because unlike web pages they're documents specifically designed to be viewed exactly as the author intended.

How many other PDF viewers let the user change the font?

Comment 16

5 years ago
(In reply to Yury Delendik (:yury) from comment #14)
> If you insist on "prettier web page" purpose of setting
> use_document_fonts=0, then I can suggest a workaround: read
> http://www-archive.mozilla.org/unix/customizing.html, userContent.css will
> let you change fonts of the content (even per domain if you want).

I don't see how userContent.css (or other CSS-based solutions such as the Stylish extension) could solve the problem. If you mean setting "font-family: inherit !important" for all HTML elements, this is not a solution as it would have side effects such as ignoring some styles in the document CSS. Disabling document fonts is not the same thing as ignoring all font family styles from documents. For instance, keeping the "font-family: monospace" from the document CSS can be important for readability.
Keeping this one opened for discussion sake and to close its duplicate bug 851369
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

Updated

5 years ago
Duplicate of this bug: 851369
(Reporter)

Comment 19

5 years ago
Nobody seems to care, closing.
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → WONTFIX
We actually have a temporary fix for this coming https://github.com/mozilla/pdf.js/pull/3195
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

Comment 21

5 years ago
When will the fix be released? I still find pdf.js unable to display text correctly in Firefox 22 due to use_document_fonts=0.

Comment 22

5 years ago
I tested on Linux and Mac, which were not working. It seems on Windows (Firefox 21) pdf.js always uses document font.
#3195 is included in bug 878897 which will be released as a part of Firefox 24.

Updated

5 years ago
Duplicate of this bug: 910940

Comment 25

5 years ago
This was fixed in Firefox 24.
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
You need to log in before you can comment on or make changes to this bug.