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.
https://forum.manjaro.org/t/font-management/117716
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:
- Put the fonts you do not want to see in the rejectfont section
- Put any fonts from the above rejection groups that you might want to keep in the acceptfont section
- 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.