When using Linux, I appreciate the fact that the open source community is comprised of people from pretty much every nation on earth. I also appreciate and laud the fact that the developers of Linux distributions try very hard to serve the various users of their distros who speak and write in languages and scripts very different from the ASCII character set that Unix started from. They have added an amazing and beautiful set of typefaces for users to express themselves with.
Whenever I am scrolling through my font menus, I am often annoyed by having to scroll through many dozens of typefaces which I will never use, specifically those with scripts I cannot read or write.
So I went in search of a non-destructive method to hide those fonts from my menus.
The easiest way I have found is to create a little
fonts.conf file, telling
fontconfig to ignore
whatever fonts or directories you don’t want it to use.
fonts.conf would be placed in your home directory and named
.fonts.conf. However, these days people have (finally) pretty much agreed on a standard way to
house all the configuration files that have traditionally floated around in the home directory. This
new standard uses the
.config directory. So the new location of the
fonts.conf file would be in
In that file, place your
fontconfig directives, which can be very flexible and complex. But I have
found that just a couple directives are enough to achieve my goal of ignoring the fonts I don’t want to
Usually, when setting up a new Linux machine, I will create a
.fonts directory in my home directory,
and copy all the fonts I actually want to use into it, including the font files for the
default sans serif
and of course the all-important monospace font for terminal and coding use.
So once you have all the fonts you need, and have changed the settings in your desktop environment to use them
(since we wouldn’t want the UI font to disappear while using it, right?), place this code into
<selectfont> <rejectfont> <glob>/usr/share/fonts/opentype/*</glob> <glob>/usr/share/fonts/truetype/*</glob> </rejectfont> </selectfont>
What this does is just ignore the
truetype directories in the system font area.
These contain the vast majority of the fonts provided by the distro, and so effectively only your
own self-provided fonts will be enabled.
There are many other directives and subtleties to the
fontconfig file format; I encourage you to seek them out
for other, more complicated font-configuration tasks.