mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.06k stars 9.81k forks source link

Font and glyph spacing on Android differ from desktop #18210

Open leoheitmannruiz opened 3 weeks ago

leoheitmannruiz commented 3 weeks ago

https://github.com/pmetzger/ShellTutorial/releases/download/20131218/ShellTutorial.pdf https://doc.cat-v.org/plan_9/9.intro.pdf

(both seem to have been created using troff)

Configuration:

Steps to reproduce the problem:

  1. View one of the two PDFs using https://mozilla.github.io/pdf.js/web/viewer.html on Android
  2. See the glyph spacing and font looking weird and differing from desktop

What is the expected behavior?

Firefox on desktop: pdf-desktop

What went wrong?

Vanadium on GrapheneOS: pdf-android

calixteman commented 3 weeks ago

The pdfs don't embed their fonts and pdf.js is falling back on the system ones. For example for the shell tuto, the missing fonts are Times-*** and very likely, whatever your desktop OS is, there's a good substitution for them. On mobile, usually, there are only few fonts which have been designed to be used on mobile... so we're falling back on a font with very different char widths. We recently fixed a similar issue for Fenix: https://bugzilla.mozilla.org/show_bug.cgi?id=1882613.

leoheitmannruiz commented 3 weeks ago

Glad to know what's going on, thanks a lot!

Can this be fixed?