PDF renders with letters touching each other
Categories
(Firefox :: PDF Viewer, defect, P3)
Tracking
()
People
(Reporter: plroskin, Unassigned)
Details
Attachments
(7 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0
Steps to reproduce:
I opened a file from https://www.faa.gov/space/additional_information/international_affairs/media/FAA_Protection_Criteria_for_FSSystems_and_Abort_IAC_Washington.pdf
(the file will be attached)
Actual results:
The file is barely readable because of missing or insufficient horizontal space between letters.
Expected results:
The rendering should be similar to that of Evince and Adobe Reader.
Reporter | ||
Comment 1•3 years ago
|
||
Reporter | ||
Comment 2•3 years ago
|
||
Reporter | ||
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Hi Pavel,
I could not reproduce this on my end but I am on a MacOS 10.15. Is this happening for you on all PDF files or only on this one?
Please try to disable all your addons, restart firefox and see if it is still reproducible.
Reporter | ||
Comment 4•3 years ago
|
||
Thank you for your quick reply!
I checked several files on my system and I found another one (somebody's resume) that renders incorrectly. It also has letters touching each other. However, there are significant differences in the way it looks. The resume also has issues with Adobe Reader and Inkscape (internal import), so I believe these are different issues that need separate tickets.
I could not find any other PDF file that renders incorrectly in Firefox only. The rendering is correct with Acrobat Reader, Evince, xpdf, gimp and Inkscape (both Poppler/Cairo and internal import).
Disabling all plugins made no difference to the rendering. Neither did the private window.
I have noticed that the font used by Firefox is different. It uses rectangular serifs, whereas the normal rendering uses curved serifs (sorry if I'm using wrong terms, it's not my area of expertise). I suspect Firefox is using a wrong font substitution. I'll post magnified screenshots.
Reporter | ||
Comment 5•3 years ago
|
||
Comment 6•3 years ago
|
||
Could you please also try out a New Profile? Here is how to do that: https://support.mozilla.org/en-US/kb/profile-manager-create-remove-switch-firefox-profiles
I also tried on Ubuntu device but with no luck, let's see how the new profile tryout goes.
Reporter | ||
Comment 7•3 years ago
|
||
I've tried a new profile, no luck. I even tried a new user. The results are the same.
However, I have found a workaround! The default font in Preferences is DejaVu Serif. If I change it to any other font, that becomes the font used in the PDF. Many other fonts work well, for instance Liberation Serif and FreeSerif. Others give somewhat crowded appearance, e.g. Century Schoolbook L and Noto Serif CJK JP. DejaVu Serif is most crowded of the serif fonts.
I can even select a sans serif font, and Firefox would render that document in that sans serif font.
I checked that document on Windows in PDF-XChange Viewer, as suggested in https://superuser.com/questions/117443/how-to-know-which-fonts-are-used-in-selected-part-of-a-pdf-document
The font name is TimesNewRomanPSMT.
I checked the appearance of DejaVu Serif, it matches the screenshot. The serifs are rectangular.
In any case, all other software does a better job rendering that document by default. I guess Firefox should recognize that the font is of the Times family and should be displayed using a font that claims to be similar. Also maybe there is a better mechanism to select glyph sizes closer to the original document.
Reporter | ||
Updated•3 years ago
|
Reporter | ||
Updated•3 years ago
|
Comment 8•3 years ago
|
||
Thanks for all the investigation done Pavel!
Although there is a workaround described here for this case, I will set up this bug as an enhancement request to improve browser font detection for PDF files. Not sure how actionable that is at this point, but developers should have better insight into this request.
Comment 9•3 years ago
|
||
(Resetting the Summary-field, since the new one doesn't seem entirely appropriate.)
This looks like another case, see also https://github.com/mozilla/pdf.js/pull/12726#issuecomment-789293128, where embedding standard fonts in PDF.js would improve rendering on Linux.
Updated•3 years ago
|
Comment 11•3 years ago
|
||
Hi Pavel,
I reported the same bug a yesterday (https://bugzilla.mozilla.org/show_bug.cgi?id=1738609).
"Glad" to know that I'm not the first one and nothing has been done about this in 8 months.
Anyway, there's an add-on for Firefox that forces it to use google's pdf viewer (don't know if you need to have Chrome installed) and that handles pdf's with weird fonts well. Here's the link:
I'm fairly sure that this has to do with fonts substitution, as I've noticed that the pdf's that display this problem have weird fonts (e.g. TimesNewRomanPSMT).
I tried messing around with my fonts.conf file (~/.config/fontconfig/fonts.conf) and that didn't seem to make a difference. Just in case, here are the contents of that file
<?xml version="1.0"?>
<!-- disable embedded bitmaps in fonts to fix Calibri, Cambria, etc. -->
<match target="font">
<edit mode="assign" name="embeddedbitmap"><bool>false</bool></edit>
</match>
<!-- Added 11/01/21 to try to make firefox 93's render pdf's correctly -->
<match>
<test name="family"><string>TimesNewRomanPS</string></test>
<edit name="family" mode="assign" binding="same">
<string>Times New Roman</string>
</edit>
</match>
<match>
<test name="family"><string>TimesNewRomanPSMT</string></test>
<edit name="family" mode="assign" binding="same">
<string>Times New Roman</string>
</edit>
</match>
<!-- end -->
Alex
Comment 12•3 years ago
|
||
Actually https://github.com/mozilla/pdf.js/pull/12726 might have fixed this and I might have wrongly duplicated them...
Pavel, can you still reproduce?
Comment 13•3 years ago
|
||
The same problem shows up when visiting https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples with Firefox in Linux Mint 19.
When viewing the above page with Firefox 19 on Windows 10, the "Hello, world!" is rendered correctly.
Alex
Comment 14•3 years ago
|
||
The problem seems to be related to pdf.js.
I just attached another image showing the different rendering under Windows 10 vs. Linux Mint 19.
Alex
Comment 15•3 years ago
|
||
Brendan Dahl, on bug https://bugzilla.mozilla.org/show_bug.cgi?id=1738609 suggested setting pdfjs.disableFontFace to true in about:config and now pdf's are displayed correctly.
Alex
Reporter | ||
Comment 16•3 years ago
|
||
I confirm the issue is fixed in Firefox 94. I don't know what's the earliest Firefox version where it's fixed. The PDF is showing with a consistent, well-looking Times-like font, even if the default fonts are all set to something different. The behavior is also correct with a newly created profile. This bug can be closed.
Comment 17•3 years ago
|
||
Hi Pavel,
The bug's still there. I just upgraded from 93 to 94 and I still have the same problem.
Unless I set pdfjs.disableFontFace to True, pdf's such as the ones I mentioned before (https://resources.finalsite.net/images/v1560883341/sandyspring/psdflzfbhjvwuasxxcym/AmericanHistory.pdf and https://www.nysd.uscourts.gov/sites/default/files/2018-06/attoneys%20manual_0.pdf) are rendered incorrectly.
Alex
Reporter | ||
Comment 18•3 years ago
|
||
Alex, this bug is about another file (FAA_Protection_Criteria_for_FSSystems_and_Abort_IAC_Washington.pdf). Does it render for you correctly? If not, can you post a screenshot? This bug was never meant to cover all issues with font rendering in PDF files.
Comment 19•3 years ago
|
||
Comment 20•3 years ago
|
||
Hi Pavel,
I didn't know this report was about firefox's behavior with one particular pdf. I thought it was about issues with certain pdf's in general.
Anyway, I have Firefox 94 now and the pdf you mentioned also renders incorrectly unless I set pdfjs.disableFontFace to True. I posted a screenshot. Like I wrote, when I change pdfjs.disableFontFace to True, that pdf displays correctly.
Alex
Comment 22•3 years ago
|
||
This file renders incorrectly on my end (Firefox 94 in Linux Mint 19), as follows:
With pdfjs.disableFontFace set to False: The title ("Retain This 1098 With Your Important Tax Records") renders in a crappy font with characters touching, and the rest of the document renders correctly.
With pdfjs.disableFontFace set to True: The title renders correctly, the rest of the document appears blank.
Comment 23•3 years ago
|
||
I was just bitten by this bug again, so I'm reopening the bug.
I uploaded a pdf (bad_pdf_2021-11-15.pdf).
This file renders incorrectly on my end (Firefox 94 in Linux Mint 19), as follows:
With pdfjs.disableFontFace set to False: The title ("Retain This 1098 With Your Important Tax Records") renders in a crappy font with characters touching, and the rest of the document renders correctly.
With pdfjs.disableFontFace set to True: The title renders correctly, the rest of the document appears blank.
Thanks!
Alex
Comment 24•3 years ago
|
||
works fine for me on Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0, might be an Linux issue
Comment 25•3 years ago
|
||
(In reply to Kenan from comment #24)
works fine for me on Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0, might be an Linux issue
Yes. It is Linux related. I indicated this in my original filing (https://bugzilla.mozilla.org/show_bug.cgi?id=1738609), which was marked as a duplicate of this one:
"Granted, the document is sheer crap and does have a mish-mash of Times Roman variants (thank you Word, possibly), but it displays correctly in Chrome in Linux and in Firefox in Windows 10."
Alex
Comment 26•2 years ago
|
||
Let's mark this as fixed and reopen alexwi original bug report, since they seem to be separate bugs after all.
Description
•