I'm configuring Ubuntu 18.04 LTS PCs for a school in Italy, and I've seen that more than 200 fonts got installed as dependencies of ubuntu-desktop
package.
We don't need most of them, we don't expect tipycal users to write or read documents in Bengali or Thai, for example. Actually, so many fonts make font choices more difficult for our users (for example in LibreOffice), because it makes difficult for them to find useful fonts.
Is there a way to disable those non-Latin fonts system wide, so they don't appear in applications?
I know I could manually remove them (for example purging fonts-tlwg-*
packages), but I want to keep them installed, so single users can enable them later on if needed, without affecting other users of the same system.
There's no need to uninstall any package, since
fontconfig
provides a way to blacklist some fonts or paths, and exclude them as if they didn't exist in the system.You just need to add a few lines like these in system or user configuration:
Where to put configuration
/etc/fonts/local.conf
~/.config/fontconfig/fonts.conf
To set the default behaviour for each new user, put this configuration in
/etc/skel/.config/fontconfig/fonts.conf
.This way unwanted fonts are disabled by default, but users can still enable them back editing their own
fontconfig
configuration file (this last approach seems more versatile for my use case).Obviously if you put this configuration in
/etc/skel/
it won't affect existing users. They need to manually copy it in their own home directories to make it work.Example configuration
Here's my full
fonts.conf
file, that disable all non-latin fonts I don't need. It lives in~/.config/fontconfig/fonts.conf
.This not only make fonts list shorter, but also make some applications such as LibreOffice a little faster, since they need to cope with less fonts to preview, and user can still enable some fonts for him/herself if needed, without affecting other users and without administrator privileges.
References
@gerlos's answer is great, but, personally, I don't like specifying individual folders for each language. This feels a bit cumbersome and seems fragile.
An alternative could be to exclude all fonts that do not support the desired language(s), e.g. English (
en
) in my case.The user config file (
~/.config/fontconfig/fonts.conf
) could then look something like this:If this is too restrictive, we can accept additional fonts as required.
Please note that
ubuntu-desktop
recommends most of those fonts packages; it does not depend on them. Hence you should be able to safely remove fonts packages and still keepubuntu-desktop
.