As I mentioned on IRC, it is quite possible that the breakage is earlier than this commit. The difference is that commits from this one on produce cache files that Bionic’s fontconfig can see (i.e. based on the MD5 of the file name), and the ones just before it don’t (i.e. a UUID matching the $dir/.uuid file).
It would probably be possible to bisect further back by generating a cache and then symlinking the UUID cache file to the equivalent MD5 name and see if the snap is still broken.
Debugging this further. The fonts work on Focal and Debian 10, both using libfontconfig 2.13.1. I’ve pulled the actual libfontconfig.so.1.12.0 binary from Debian and font files. Also mounted an empty tmpfs over /etc/fonts (and then /etc/fonts/conf.d) to make sure we’re using a vanilla config. Then symlinked the MD5-named cache file expected by gnome-3-28-1804 is symlinked to the right UUID-name file as expected by the Debian version.
In the end fonts were still rendering as boxes, suggesting that perhaps problem is somewhere else in the stack. I need to consult with @jamesh on how to proceed with debugging this.
Once you do fc-cache -f on the host, and then run the snap again, the font should be broken in snaps again. I haven’t been able to do it yet, but the next step is probably dissecting the cache file generated by 2.13.1 and 2.13.92+ to check the differences.
Thank you for that fix. It makes one wonder why there is still font caching in Linux at all considering it takes about 600ms for fc-cache to run so why does it even exist? Seems like some relic of the Xfree86 days, as in 1986 presumably(?)
Could you test mattermost-desktop? Maybe this is an issue with the electron-builder tooling. The mattermost-desktop snap uses electron but not the electron-builder tooling.
This is a great test case, which is very difficult to reproduce. Could you please test the inkscape snap? There’s been a proposed fix for fontconfig mismatches in the inkscape snap and we would love to get confirmation that it works in cases like your’s.
It is pretty hard to reproduce, if you aren’t a daily Fedora user. I just did a fresh install of Fedora 32 earlier this week and couldn’t reproduce the font issue. I’ve tried this a number of times with different versions of Fedora in the past and never reproduced it myself. It’s all related to the version of fontconfig that was used to generate cache files on the host. How recent was your fresh install? Was your homedir preserved from a previous install?
Thanks for the info!
@ted ^^ confirmation the snap private font caches seem to fix the issue, thanks for being a guinea pig.
Please make sure you remove ~/snap/inkscape/common/.cache/fontconfig directory first. FWIW the inkscape snap from edge works here on Arch too.
The gimp or glimpse-editor snaps segfault and render boxes in the splash screen, but as I understand those do not have the special sauce @kenvandine added.
Fedora 2.45 package has some cherry-picks that disable system font cache handling. You may need to remove the user’s fonts cache too rm -f ~/.cache/fontconfig/* and one from the snap, usually ~/snap/codium/common/.cache/fontconfig/*. Unfortunately deskop helpers do some weird thing and copy over the user’s fonts cache (which may have been generated with a problematic version of fontconfig), to the snap. Hence, a workaround is needed.
@mborzecki For me this wasn’t enough, on Fedora 32 KDE. For example, with the boxy-svg snap I had to remove the snap’s fontconfig folder entirely, and replace it with an empty file to prevent it from being created again, or else every time the snap launched it would regenerate the problematic fontconfig cache, and fonts wouldn’t work.
There is one caveat to this, is that every time I use the snap, the first time I do something that requires fontconfig cache, it hangs for a few seconds and then works.