flatpak / flatpak

Linux application sandboxing and distribution framework
https://flatpak.org
GNU Lesser General Public License v2.1
4.25k stars 406 forks source link

[Bug]: Flatpak apps do not use default system font #5995

Open d1Bihkte opened 1 week ago

d1Bihkte commented 1 week ago

Checklist

Flatpak version

1.14.6

What Linux distribution are you using?

Ubuntu

Linux distribution version

24.04.1 LTS

What architecture are you using?

x86_64

How to reproduce

  1. Install Ubuntu 24.04.1 ISO and select Sinhala as system language during installation.
  2. Install Flatpak and install e.g. obsstudio, onlyoffice, vivaldi. (these apps use system font to display Sinhala and do not use their own / custom fonts).

Notes: I couldn't find this bug on any .deb apps or snap apps. Ubuntu default font for Sinhala is Noto Sans / Serif Sinhala.

It seems that Flatpak apps use Dejavu Sans for Sinhala. They do not have a special variant for Sinhala and it's not a readable font.

Expected Behavior

OBS Studio

Screenshot from 2024-11-07 00-52-22

ONLYOFFICE

Screenshot from 2024-11-07 00-40-26

Vivaldi

Screenshot from 2024-11-07 01-00-53

Actual Behavior

OBS Studio

Screenshot from 2024-11-07 00-50-25

ONLYOFFICE

Screenshot from 2024-11-07 00-35-11

Vivaldi

Screenshot from 2024-11-07 01-04-49

Additional Information

This bug is related to https://github.com/flatpak/flatpak/issues/5730 but i decide to open separate issue because,

I would like to track the issue here and provide additional information if needed.

https://github.com/flatpak/flatpak/issues/5675

chrisawi commented 1 week ago

I'm not a fontconfig expert, but I suspect that this may be a consequence of not including /etc/fonts/conf.d configuration from the host: https://github.com/flatpak/flatpak/issues/1563

I lensed a bit of text from one of your screenshots ("ප්‍රචාරයට ප්‍රශස්තිකරණය, පටිගත කිරීම දෙවනුව"), and I see a similar difference in rendering between host and flatpak apps on Fedora 41.

fc-match -v ':charset=0DA0' | grep file on the host returns /usr/share/fonts/google-noto-vf/NotoSerifSinhala[wght].ttf vs /usr/share/fonts/gnu-free/FreeSerif.ttf inside a flatpak sandbox (using flatpak run --command=sh ... to open a shell). Do you see similar results?

d1Bihkte commented 6 days ago

Do you see similar results?

Yes

Host: file: "/usr/share/fonts/truetype/noto/NotoSansSinhala-Regular.ttf"(s) Flatpak: file: "/run/host/fonts/truetype/freefont/FreeSerif.ttf"(s)

razinares commented 5 days ago

Try this https://github.com/flathub/org.chromium.Chromium/issues/238#issuecomment-1198639352

d1Bihkte commented 5 days ago

Try this flathub/org.chromium.Chromium#238 (comment)

Thank you. Currently i use .deb and snap apps. I'll try to forget about flatpak till developers fix this.

cc: @alexlarsson @smcv

smcv commented 5 days ago

Please don't arbitrarily @ specific developers just because you find a particular issue annoying. Our time is limited and we are not necessarily the most knowledgeable person about a particular issue.

Unfortunately, it is intentional that Flatpak apps do not copy all font settings from the host system, because that would sometimes break apps completely. Flatpak needs to be able deal with the host system and the app having different versions of libfontconfig - on some systems it will be newer in the app than on the host system, and on some systems it will be the other way around. Either of these can break apps, because the configuration language used for font settings depends on the libfontconfig version.

1563, #2272, #3947, #4742 are all relevant pre-existing issues with a lot of discussion about why none of the simple, obvious solutions that various people have proposed are actually simple or obvious.

CaptainCoward commented 3 days ago

I have pretty much the same issue. I know for a fact that it happend after updating all flatpaks via flatpak update. Before i didn't have this issue. And it is only on wayland. On X11 i don't run into that issue. If needed i can provide a list of the Apps that got updated (it is stored on my other computer). In case it is helpful.