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.
Recently I was digging into the following font related bug report:
Itās not an identical problem, but I think it might point to the root cause: that the contents of the fontconfig cache depend on both the fontconfig version (for the exact cache file format) and Freetype version (for what information about the font is stored in the cache).
One possibility here is that the host system has a newer Freetype than inside the snapās sandbox, so the host system fontconfig caches suggest the use of a font in a way the sandbox Freetype canāt handle.
I think the solution is going to involve ignoring the host system fontconfig caches, and having each GNOME platform snap create and maintain a fontconfig cache that matches their (fontconfig, freetype) pair. By having all snaps that use the same platform snap share the cache, the overhead should be manageable.
FWIW, I see this problem in Kubuntu 20.04 with Plasma. When I first install my snap using the gnome-3-28 extension, I see rectangles. The suggested workaround fixes it:
I am trying to follow along with all of you but wondering if this is the same error.
$ cloudcompare.CloudCompare
QSocketNotifier: Can only be used with threads started with QThread
Gtk-Message: 21:49:04.756: Failed to load module ācanberra-gtk-moduleā
Gtk-Message: 21:49:04.790: Failed to load module ācolorreload-gtk-moduleā
Fontconfig warning: FcPattern object weight does not accept value [40 210)
Segmentation fault (core dumped)
This does not work for me on Manjaro KDE and trying to use CloudCompare:
rm ~/.cache/fontconfig/*
[somebody ~]$ fc-cache -r
[somebody ~]$ cloudcompare.CloudCompare
QSocketNotifier: Can only be used with threads started with QThread
Gtk-Message: 21:14:02.771: Failed to load module "canberra-gtk-module"
Gtk-Message: 21:14:02.806: Failed to load module "colorreload-gtk-module"
Fontconfig warning: FcPattern object weight does not accept value [40 210)
Segmentation fault (core dumped)
I know there is some ongoing work to make the snap caches private to respective snaps. @kenvandine did a PoC with Inkscape snap which worked well when I tried it. Perhaps he or @jamesh can comment on the current status.
@kenvandine@jamesh would love to learn more about your work and how you worked around this problem. Even if I have to hard-code a font into my app or something it would be a big improvement.