Noto is an impressive accomplishment, no doubt. And it's a noble thing to want to enable all the people of the world to see their native writing systems accurately represented on their computers, by default, out of the box.
Sadly, the technical implementation (at least for Debian-derived Linux distros) leaves a lot to be desired, because of the hundreds of separate fonts that comprise Noto. These clog up font menus and make selecting from the fonts for the languages you actually use more of a chore.
This script allows you to selectively disable fonts that don't support your language(s), but easily re-enable them if necessary. While this is technically possible with point-and-click interfaces like Font Manager, it can take hundreds of clicks to get them all.1
It's a much better solution than what is commonly recommended, which is to remove a bunch of font packages, upon which other packages often depend. This can result in a broken system, or at least accidental removal of some applications that you didn't intend to remove.
GIST='https://gist.githubusercontent.com/ernstki/2ae279ad89888e4099c9852bf0ba5d11/raw/fc-reject.pl'
curl -Lo fc-reject.pl $GIST || wget -O fc-reject.pl $GIST
mkdir -p ~/.config/fontconfig/conf.d
# assuming the Bash shell
chmod a+x fc-reject.pl
./fc-reject.pl > ~/.config/fontconfig/conf.d/88-reject.conf.new && \
mv ~/.config/fontconfig/conf.d/88-reject.conf{.new,}This will hide any fonts matching the $filterfam regular expression which don't specify $mylangs (also a regexp) as one of their supported languages. This greatly reduces the length of font selection drop-downs in applications like GIMP or LibreOffice, making it easier to find the fonts you do use.
If you wish to name the file something else besides 88-reject.conf, just make sure it ends in .conf and begins with two digits. This is a requirement for fontconfig to find it.
Tip
As suggested by @DJGoossens below, you may be able to re-use the same filename Font Manager uses, or at least copy-paste the relevant parts from the output of fc-reject.pl into an existing config. This allows you to employ the Font Manager GUI for further refinements.
You can see whether or not it worked by grepping the output of fc-list for fonts that you're sure should be excluded:
fc-list | grep DevanagariThere should be no output, or at least no Noto fonts in the output. Obviously I'm writing this from the perspective of a Westerner who can't read non-Latin scripts, so substitute with something appropriate for you.
There may be rare cases (which I haven't encountered) where you need to regenerate fontconfig's caches from scratch. If you run into that situation
fc-cache -rvshould do the trick for that.
To undo what the script has done simply remove the .conf file. Changes take effect immediately. Some programs may need to be restarted, though.
You can momentarily disable the config (re-enabling all the excluded fonts) by renaming it to not have a .conf extension, like so:
# e.g., for the Bash shell
mv ~/.config/fontconfig/conf.d/88-reject.conf{,.disabled}Incidentally, visiting the Wikipedia article for Linear A is an effective test to see if Noto—and the above script—is doing its job. That is, if the font is properly installed, you should see "no tofu" (no Unicode replacement symbols) in that article.
- Font configuration files - freedesktop.org
- Font Manager - GTK-based GUI which can do what this script does and more
- fc-json - print the output of
fc-catas JSON
Footnotes
-
…at least with the version of Font Manager that's in the LTS repositories as of this writing ↩
On Ubuntu 22.04 you might want to re-enable the emoji by removing
Noto Color Emojifrom the output. Otherwise you won't even see the 👍 in GitHub.And maybe
Noto MusicandNoto Sans SymbolsandNoto Sans Symbols2-- although I'm not sure how often you run into those.As for the harmless warning, I suggest:
The atomic mv ensures that only the complete file is read.
Thanks for this gist, @ernstki !
My changes: