flathub/org.gimp.GIMP

Half of the fonts missing, missing ones seem to be OTF and present ones TTF

Opened this issue · 16 comments

In FlatHub's GIMP 2.10, half of the fonts missing, missing ones seem to be OTF fonts, and present are as far as I can tell mostly TTF fonts. In Fedora's natively packaged GIMP 2.8, all fonts show up. All TeX fonts for example like TeX Gyre Pagella or Adventor are non-TTF and don't show up and they are a nice collection under good licensing, so it'd be really good if this could be fixed.

Anyone has an idea how to work around this? I saved my file with GIMP 2.10 already before noticing this, and I would really love to keep using the new GIMP version, but I kinda need to be able to change texts in my images...

Ok, if anyone on Fedora 28 has the same issue, this version works properly: https://copr.fedorainfracloud.org/coprs/srakitnican/gimp-2.10/ (shows all fonts unlike the flathub one)

Jehan commented

My guess is that /etc/fonts/fonts.conf should simply be patched to include common fonts directories which have been relocated under /run/host/.
I'll make some tests locally then I will update our flatpak and if all goes well, I'll make a patch to the Freedesktop SDK.

Jehan commented

This being said, I just tested (on Fedora 28 as well) and it looks like I have all the fonts actually!

@Jonast Do you have an example of fonts which you don't see in GIMP flatpak, and where is it installed (or if it comes from a package, what's the name of this package)?

Tex Gyre Pagella, Tex Gyre Adventor and others are missing. They are .otf files, and seem to be located in /usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/. Not sure what the exact package name is, but they're installed as part of texlive.

Edit: full list of relevant paths for Tex Gyre Pagella:

# locate pagella
/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-bold.otf
/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-bolditalic.otf
/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-italic.otf
/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf
/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf
/usr/share/texlive/texmf-dist/tex/latex/tex-gyre/tgpagella.sty
/usr/share/texlive/texmf-dist/tex/plain/font-change/font_pagella.tex

@Jehan was this fix ever released? Still not seeing those fonts and therefore unable to fully use the flathub version... (and the distro packaged one is super outdated 😢 )

Jehan commented

@Jonast No I have not had the time to look more deeply into this issue.

I am alone to maintain the flatpak package (and that's not the only thing I do, I also maintain, fix and improve various parts of core GIMP) so I would greatly appreciate if anyone could help with diagnosing and improving the flatpak build.

Otherwise I will look into it at some point, but I can't promise when. :-/

For what it's worth, just installing the TeX Gyre font package with # dnf install texlive-tex-gyre should be enough to reproduce it, at least on Red Hat's Fedora. You can confirm the correct package is installed by running # updatedb && locate pagella which should list texgyrepagella-regular.otf in a folder among others. You can then check the bug by just opening up flathub-packaged GIMP and checking the font list - TeX Gyre Pagella is supposed to be there if things worked. (for me it isn't)

Jehan commented

@Jonast So I had a quick test and confirmed that I also had the fonts under /usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre/, these are seen by native GIMP, not by flatpak GIMP.

So I investigated a bit. The fontconfig within the sandbox has this file for configuring host fonts /etc/fonts/conf.d/50-flatpak.conf. In particular, this line is of interest:

<dir>/run/host/fonts</dir>

As expected, I could check that /run/host/fonts maps to the system default fonts folder, which on Fedora is /usr/share/fonts/.
The problem seems to be that 4 folders under /usr/share/fonts/ are set as symbolic links: lm, lm-math, tex-gyre and tex-gyre-math (on my particular Fedora installation, someone else could have less or more depending on what font packages you installed). Unfortunately the flatpak sandbox was not able to reconstruct these folders after the remapping, so these symlinks end up broken (they link to paths which don't exist anymore).

I will have to report the bug upstream (to the Freedesktop runtime as I see that fontconfig is coming from there).

For the time being, you can add your fonts manually by opening the Preferences > Folders > Fonts and adding the folder /run/host/usr/share/texlive/texmf-dist/fonts/opentype/public/tex-gyre (basically all folders of the host system are still available by adding /run/host/ prefix).

Thanks so much for looking into this!! 🎉 🎈

The GIMP flatpak from registry.fedoraproject.org has the fonts working correctly somehow, so maybe you can look how they've done it.

Unfortunately their flatpaks all only provide English versions though - can't have it all I guess…

Jehan commented

@DanMan I had no idea that Fedora had its own flatpak repository. Where can I see the manifest? When I click on GIMP on the page you give, I get a blank page.

Jehan commented

P.S.: I found this, but the files are weird: https://src.fedoraproject.org/flatpaks/gimp/tree/master

I had a look, but I couldn't find it myself. Probably buried in some sort of build system.

Any traction on this ?