By Cmarch
Many unwanted fonts get installed on Linux systems, and that can make the font scroll list in editors and word processors painfully long. There are many methods and apps to trim font lists, but somehow those unwanted fonts always creep back in when your back is turned, or you do a reinstallation.
An easy solution to tame those unwanted fonts is to use a ~/.config/fontconfig/fonts.conf file to whitelist and blacklist fonts. It’s easy to implement, can be easily modified, and can be saved and used over and over. Another benefit is the fonts are not deleted, they just don’t show up in your user session. All fonts listed in the
Edit or create a ~/.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
section that you might want to keep in the section. - Fonts not added to the
section will not be affected.
A sample ~/.config/fontconfig/fonts.conf file might look like this:
/usr/share/fonts/noto/Noto* /usr/share/fonts/gsfonts/* /usr/share/fonts/TTF/DejaVuMathTeX* /usr/share/fonts/TTF/odo* /usr/share/fonts/mathjax2/* /usr/share/fonts/croscore/* /usr/share/fonts/noto/NotoSans-* /usr/share/fonts/noto/NotoSerif-* /usr/share/fonts/gsfonts/NimbusMono* /usr/share/fonts/gsfonts/NimbusRoman* /usr/share/fonts/gsfonts/NimbusSans* /usr/share/fonts/gsfonts/URW* In thisfonts.conffile all the Noto fonts were initially rejected and then later NotoSans and NotoSerif were added back by whitelisting them.
Note:
- Your fonts.conf file may contain other useful stuff, that’s ok, leave it there.
- Be sure and save a backup of this file for future use. If your working fonts.conf file gets deleted or disappears on a reinstallation of your OS, you can always recover it.
In this fonts.conf file all the Noto fonts were initially rejected and then later NotoSans and NotoSerif were added back by whitelisting them.
For reference see:
- Font Management – https://wiki.archlinux.org/title/Fonts
- Whitelist and blacklist fonts. – https://wiki.archlinux.org/index.php/Font_configuration#Whitelisting_and_blacklisting_fonts
