Bug 421027 - Different fonts chosen to replace Helvetica inside and outside flatpak
Summary: Different fonts chosen to replace Helvetica inside and outside flatpak
Status: REPORTED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-04 22:54 UTC by Viktor
Modified: 2020-05-11 21:39 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Flatpak (left) wrong rendering (599.06 KB, application/pdf)
2020-05-06 15:28 UTC, Viktor
Details
used pdf file in screenshot (15.97 KB, application/pdf)
2020-05-06 20:17 UTC, Viktor
Details
fonts used 1 (362.32 KB, image/png)
2020-05-06 22:45 UTC, Viktor
Details
fonts used 2 (360.67 KB, image/png)
2020-05-06 22:45 UTC, Viktor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Viktor 2020-05-04 22:54:09 UTC
SUMMARY
Text in PDFs and annotations are rendered wrongly on version 1.10 installed through Flatpak. The typewriter annotation is invisible too. All works fine when 1.9.3 is installed from Ubuntu's repositories.

What could be causing this?

OS is Pop OS 20.04, GNOME 3.36
Comment 1 Albert Astals Cid 2020-05-05 20:36:16 UTC
Please attach screenshots and file used for those screenshots
Comment 2 Viktor 2020-05-06 15:28:18 UTC
Created attachment 128196 [details]
Flatpak (left) wrong rendering

Flatpak (on the left) has wrong rendering of the text and the text boxes which are invisible. All annotations have been made in Okular 1.9.3
Comment 3 Albert Astals Cid 2020-05-06 19:50:27 UTC
Can you attach the pdf file?
Comment 4 Viktor 2020-05-06 20:17:37 UTC
Created attachment 128206 [details]
used pdf file in screenshot
Comment 5 Albert Astals Cid 2020-05-06 21:55:22 UTC
Can you attach a screenshot of File->Properties->Fonts for both?
Comment 6 Viktor 2020-05-06 22:45:15 UTC
Created attachment 128207 [details]
fonts used 1
Comment 7 Viktor 2020-05-06 22:45:34 UTC
Created attachment 128208 [details]
fonts used 2
Comment 8 Viktor 2020-05-06 22:55:07 UTC
Here are some errors that also pop up on running the flatpak - https://pastebin.com/G1nTUQwy
Comment 9 Albert Astals Cid 2020-05-09 22:25:33 UTC
Yeah, as I suspected the file doesn't have the fonts attached so we're calling fontconfig to return us the font the system things we should be using.

In your system for Helvetica it says NimbusSans-Regular.otf but in the flatpak runtime it says qhvr.pfb, that's why you get different font renderings.

I have a similar issue locally

tsdgeos@xps:~:$ fc-match Helvetica
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
tsdgeos@xps:~:$ flatpak run --command=sh --devel org.kde.okular 
tsdgeos@xps:~:$ fc-match Helvetica
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"

I don't think Okular flatpak can actually control that.

Maybe Jan (or resident flatpak expert) has an idea, adding him to the CC.
Comment 10 Jan Grulich 2020-05-11 06:03:51 UTC
I don't know much about how fonts do work, but you should be able to access system fonts inside Flatpak sandbox, because they are mounted into /run/host/fonts and fontconfig is configured accordingly to search in this place. Probably fonts in the runtime itself have higher priority or are in first positions when searching for a suitable font and that's why they get picked instead of the font you would prefer.

If I run fc-list inside the sandbox, I see all the system fonts available, but I have no idea how it gets decided which font gets picked.
Comment 11 Albert Astals Cid 2020-05-11 21:39:49 UTC
According to https://github.com/flatpak/flatpak/issues/1563 it seems it's just one of those things that it's not polished enough yet in flatpak