User Tools

Site Tools


Sidebar

Index

linux:remove-foreign-fonts-get-rid-asian-oriental-fonts

Remove foreign fonts: get rid of oriental/asian fonts from Mint/Ubuntu

I personally don't need hundreds of indian regional fonts, japanes and many other oriental fonts for languages I've never heard of. How to clean the system removing all the useless fonts?

Basically in Linux Mint the font packages useful for english, italian, french, german, etc, are only these (everyone contains multiple fonts):

fonts-dejavu
fonts-dejavu-core
fonts-dejavu-extra
fonts-freefont-ttf
fonts-liberation
fonts-mathjax
fonts-noto-mono
fonts-opensymbol

totalling 45 subfonts.

Finding the package name connected to a font name it's not easy peasy but in the end I managed to set up a bash script to clean everything.

purge-orient-fonts.sh
#!/bin/bash
# www.riksoft.it/wikiriks
# Remove all oriental fonts in Mint 18 (surely OK for Ubuntu 16 as well)
 
for i in fonts-kacst fonts-kacst-one fonts-khmeros-core fonts-lklug-sinhala fonts-guru fonts-nanum fonts-noto-cjk fonts-takao-pgothic fonts-tibetan-machine fonts-guru-extra fonts-lao fonts-sil-padauk fonts-sil-abyssinica fonts-tlwg-* fonts-lohit-* fonts-beng fonts-beng-extra fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra fonts-kalapi fonts-lohit-gujr fonts-samyak-* fonts-noto-unhinted fonts-noto-hinted fonts-navilu fonts-nakula fonts-orya-extra fonts-pagul fonts-sahadeva fonts-sarai fonts-smc fonts-telu-extra fonts-wqy-microhei; do
  sudo apt purge -y $i
  echo
done
 
echo "==== Fixing font cache"
sudo fc-cache -f -v && sudo dpkg-reconfigure fontconfig
 
echo "==== Packages remained (each containing multiple fonts)"
dpkg -l fonts\*|grep ^ii|awk '{print $2}'
 
 
echo
read -p "Press any key to close."

The reason I've used a for loop instead of putting the list of packages in a single line of apt purge, is because this way if a font is missing the script keeps going. On the contrary it would stop at the first missing font.

linux/remove-foreign-fonts-get-rid-asian-oriental-fonts.txt · Last modified: 2017/04/20 14:57 by rik