IsaacSchemm / pdf.js-seamonkey

SeaMonkey fork of pdf.js
Apache License 2.0
25 stars 4 forks source link

Fails to Use Embedded Font #14

Open DavidRoss opened 3 years ago

DavidRoss commented 3 years ago

Windows 7 Ultimate SP1 x64 SeaMonkey 2.49.5 PDF Viewer 2.3.235 as an extension

PDF file at http://www.rossde.com/closingUFCUaccount.pdf was created from a Word document by doPDF 11.0.125. The header of the Word document (my name and city) uses the Shelley Andante BT font, which was embedded in the PDF file by doPDF. If you download the PDF file and view it with Adobe Reader you see the use of Shelley Andante BT. However, if you view the PDF file within SeaMonkey using the PDF Viewer extension, a much different font is seen. This does not happen if you view the PDF file within Internet Explorer.

IsaacSchemm commented 3 years ago

Out of curiosity, what happens if you view it within Firefox?

DavidRoss commented 3 years ago

I do not have Firefox installed.; I do not plan to install it As noted before, when I view the file with Internet Explorer or Adobe Reader, the file is displayed with the correct fonts.

dilworks commented 3 years ago

OK, I know that some of us use Seamonkey because we can't stand Mozilla mis-decisions with Firefox, so I went and tested ahead for you.

FF78.0.9 ESR (from Debian repos), and indeed the PDF doesn't render with the expected font.

...BUT!

I saved the file, opened it on my PDF reader (Atril), and it also doesn't render properly. And the reason is simple: after checking the PDF font list, it says it uses "ShelleyAndanteBT-Regular", TrueType, not embedded. For whatever reason, doPDF is failing to properly embed the font on your PDF, which leads us to believe your PDF is broken and there is no bug.

However, since the PDF indeed is telling your PDF reader to fallback on fonts installed on your system, and you claim Adobe Reader does render the PDF properly (presumably using the font which IS installed on your computer), it might be indeed a legit bug (pdf.js ignoring system-installed fonts), but slightly different than your original case (pdf.js ignoring embedded fonts)

Can you try to produce your PDF file with properly embedded fonts this time? (I'm not familiar with doPDF's settings, but try checking them to ensure your producer is actually embedding the fonts, or switch to another PDF generator)

dilworks commented 3 years ago

Went ahead, found the font, installed on my system (Linux; Debian 10; AMD64), and did some testing:

I dug deeper, and found it might be a possible issue between the font and Mozilla: try this fiddle: https://jsfiddle.net/2a3pdku1/1/ The font gets detected by Mozilla as "ShelleyAndante BT" - notice the missing space on the name! (other fonts I've tried, like Synergy Basic BC, doesn't seem to exhibit this problem). Dunno what the heck is happening here, but certainly there is a bug somewhere.

DavidRoss commented 3 years ago

Yes! doPDF has a checkbox on its file-save dialogue window for including all used fonts. I did not notice it until I read the doPDF User Manual. I again "printed" the Word document to a PDF file after checking that checkbox. PDF Viewer now displays the PDF file with the correct fonts.

Yes, you might have a bug in PDF Viewer if it is not using an available font when displaying text indicating that font, even if the font is not embedded. However, such a bug is no longer as important as I first thought.

dilworks commented 3 years ago

Given that the issue happens even on plain HTML+CSS, it's not even a pdf.js bug, rather it's an issue with the underlying Mozilla/Gecko engine. Worth taking a look at Mozilla's Bugzilla, as it happens even on upstream unmodified Firefox.