common: write a user fonts.conf file rather than symlinking fonts into $XDG_DATA_HOME #87

Merged
merged 1 commit into from Nov 29, 2017

Conversation

Projects
None yet
3 participants
Contributor

jhenstridge commented Nov 27, 2017

This PR changes the way we get fontconfig to find the fonts provided by the snap.

Rather than symlinking the snap's fonts to $XDG_DATA_HOME/fonts, we instead write a config file to $XDG_CONFIG_HOME/fontconfig/fonts.conf that augments the fontconfig search path with the locations within the snap.

This has a few benefits:

  1. if the app is using the GNOME platform snap, we can let it see fonts from the both the app snap and platform snap.
  2. We can also point it at fonts in the user's home directory, fixing bug #85.

In addition to (2), I also provide access to the user's local fontconfig cache directory to avoid the need to scan fonts found there. It doesn't seem worth trying to use caches from the snaps though, since the caches are keyed off paths and snap paths change with each revision.

common: rather than symlinking fonts into $XDG_DATA_HOME, write a fon…
…ts.conf file

This way we can point at multiple snap font directories (e.g. bundled
with app vs. bundled with platform snap), and also expose fonts in the
user's real home directory.
Contributor

oSoMoN commented Nov 29, 2017

This looks good to me, and does indeed what it says, but apparmor denies access to /home/$USER/.local/share/fonts/, so the snap can't see the fonts the user installed there. Fonts installed in /home/$USER/.fonts are seen though.

This appears to be because the apparmor fonts abstractions only allows read access to @{HOME}/.fonts/, not @{HOME}/.local/share/fonts/.

@kenvandine kenvandine merged commit 4974c63 into Ubuntu:master Nov 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment