Tip: Managing fonts

Tons of fonts get installed on linux systems and that makes the font scroll list in editors or word processors painfully long. I’ve always used the font manager in kde to hide fonts or I manually deleted the fonts that I did not want. But somehow those unwanted fonts always crept back in when my back was turned. Then I found a solution using ~/.config/fontconfig/fonts.conf. Thanks to Ferdinand on the Manjaro forum.


Also see:
Whitelist and blacklist fonts.
https://wiki.archlinux.org/index.php/Font_configuration#Whitelisting_and_blacklisting_fonts

This solution is easy to implement, can be easily modified, and can be used over and over. A benefit is the fonts are not deleted, they just don’t show up in your user session.

Edit your ~/.config/fontconfig/fonts.conf file and:

  1. Put the fonts you do not want to see in the rejectfont section
  2. Put any fonts from the above rejection groups that you might want to keep in the acceptfont section
  3. Fonts not added to the rejectfont section will not be affected.

My ~/.config/fontconfig/fonts.conf file:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <!-- Local settings -->
 <selectfont>
    <rejectfont>
       <glob>/usr/share/fonts/noto/Noto*</glob>
       <glob>/usr/share/fonts/gsfonts/*</glob>
       <glob>/usr/share/fonts/TTF/DejaVuMathTeX*</glob>
       <glob>/usr/share/fonts/TTF/odo*</glob>
       <glob>/usr/share/fonts/mathjax2/*</glob>
       <glob>/usr/share/fonts/croscore/*</glob>
    </rejectfont>
    <acceptfont>
       <glob>/usr/share/fonts/noto/NotoSans-*</glob>
       <glob>/usr/share/fonts/noto/NotoSerif-*</glob>
       <glob>/usr/share/fonts/gsfonts/NimbusMono*</glob>
       <glob>/usr/share/fonts/gsfonts/NimbusRoman*</glob>
       <glob>/usr/share/fonts/gsfonts/NimbusSans*</glob>
       <glob>/usr/share/fonts/gsfonts/URW*</glob>
    </acceptfont>
 </selectfont>
</fontconfig>

Note: Your fonts.conf file may contain other useful stuff, that’s ok, leave it there.

7 Likes

Good one. A wiki entry perhaps?

2 Likes

That’s a nice tip!
Surely worth a wiki article.

2 Likes

That was awesome! Just hid three files and now my font menus are manageable. Thanks!

1 Like