Fixing fonts on the FreeCAD snap

There is an issue on the FreeCAD snap whereby whenever using fonts, they can be picked from a font selector, but the chosen font is not rendered. This issue is not present on the FreeCAD daily PPA package. There fonts can be chosen and the chosen one is rendered, so this is probably related to the snap package.

Here is the actual issue: Fonts are not rendered · Issue #106 · FreeCAD/FreeCAD-snap · GitHub and FreeCAD’s snapcraft.yaml file.

I built some snaps a while back, and I’d like to tackle this issue. However, I don’t know where to start when it comes to fonts and snaps. I would welcome any pointers. Thank you!

Is there anyone who would have any pointers on this? Otherwise it’s going to be back to the PPA. Thanks.

Commented in the github issue

From the GitHub issue:

Information on how to add font support to snaps seems inexistent, or at least I’m unable to find it. The closest I found was this comment from a bug report:

Workaround for this issue: (in apps section) apps: some_app: command: some_app environment: XDG_DATA_HOME: $SNAP/usr/share FONTCONFIG_PATH: $SNAP/etc/fonts/conf.d FONTCONFIG_FILE: $SNAP/etc/fonts/fonts.conf

Of course this only works in devmode. After switching to strict mode program in snap ends with error that it can’t reach /etc/fonts/fonts.conf file. I think should be resolved by adding interface.

These environment variables are not defined in FreeCAD’s [snapcraft.yaml](https://github.com/FreeCAD/FreeCAD-snap/blob/master/snap/snapcraft.yaml) file. On my system:

  • /snap/freecad/etc/fonts/conf.d is empty
  • /snap/freecad/etc/fonts/fonts.conf does not exist.
  • $HOME/snap/freecad/common/.cache/fontconfig/ has lots of files in it

Digging deeper, it seems that fonts should be handled by the kde-neon extension, as defined in snapcraft.yaml

That’s where I’m now stuck. Any comments from any font/snap experts will be highly appreciated.