I noticed that Firefox recently started displaying PDFs incorrectly. I’m not sure what I did to cause this but when I visit this public example PDF. After searching I found that it is related to the “Allow pages to choose their own fonts, instead of your selections above” check box in the “Advanced” dialogue of the “Fonts” settings.
This box is ticked on my system and instead of showing PDFs properly, most of the text is missing… Unchecking the box fixes it.
If I download the PDF and use Gnome’s document viewer, it works fine.
Does anyone know why Firefox does this on my system? I haven’t played with any settings in Firefox in a while, so I’m pretty sure this used to work.
I’m assuming that this has to do with Web Fonts and may cause issues with web sites that use them.
Try using the using the font tab in Firefox’s Page Inspector to see what fonts are being loaded. You may be missing a font, or you may have a conflicting font which must be removed.
Thank you @BluishHumility for the suggestion. I have managed to collect interesting information:
The problem seems to be only with PDF viewer. Using the font inspector I was able to verify that various pages I tried would download and use various fonts not installed on my system and those looked the same in other browsers (Chrome/Edge) as well as when trying the same pages in Windows. So in general this works well
I have screenshots of the linked document on page 13 showing how some monospace and even some regular text is displayed fine, but most of it is missing. In the <span> tags I identified I do not see something suspicious in the inspector for the part of the text that is visible and the part that is not visible.
I am attaching screenshots for my settings and the rendering problem from point (2).
Do you thing this could be a Firefox bug? Chromium shows the same document with no issues on the same EndeavourOS system. I tried Flatpak installation of Firefox and it seems to have the same issue…
Here is the invisible text with the span specifying the font as sans-serif:
I tried to reproduce this, but in my case that same website shows up just fine. I normally use Librewolf, but I installed Firefox to test and still the page does not have blank areas like yours. I confirmed the “Allow pages to choose their own fonts” box is checked.
Same here, shows fine, box ticked or not, I suppose the fonts are embedded in the document (edit: and I guess most of them don’t use external fonts), because the inspector says no fonts are used.
It might not be the best solution, but you can replace the internal pdf viewer with an external one.
I have finally got to the bottom of this. It is a hardware rendering problem: turning off H/W acceleration in “Settings / General / Performance” fixes my rendering.
I had recently switched to using the VirtIO-GL driver for my VM about a month ago, but it seems that it is still buggy.
I’m now back to VirtIO-GPU and re-enabled hardware acceleration, as that works fine with this driver.
Thank you for your help narrowing this down @BluishHumility.
So every letter of the word uses the same font. I conclude, therefore, that the problem is not due to the fonts you have installed on your system, but perhaps rather with a malfunction of the PDF rendering engine, pdf.js, used by Firefox.
A similar issue to yours was reported (by a Windows user) last month, but a solution has not yet been offered:
Are you using the standard installation of firefox from the Arch repos?
$ pacman -Qi firefox
Name : firefox
Version : 117.0.1-1
If you uninstall firefox and then reinstall, does the problem persist?