Remove unecessary / unwanted fonts
# Set some system variables to shorten the file paths. | |
MP="media/$USER/PSSD-T7" # MP=Install from Media Path | |
DV="linuxmint201" # DV=Distro Version | |
CF="media/$USER/PSSD-T7/common" # CF=File path for common distro files | |
# Get sudo going, enter password. | |
sudo test | |
# | |
echo "Purging fonts for EMA and APJ languages ..." | |
echo " " | |
sleep 1 | |
# Note: Calling out the specific name for each font pkg rather than a | |
# glob making it faster and easier on APT not to reject uninstalled pkgs. | |
sudo apt-get purge -y \ | |
fonts-beng fonts-beng-extra fonts-deva fonts-deva-extra \ | |
fonts-droid-fallback fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra \ | |
fonts-guru fonts-guru-extra fonts-indic fonts-kacst fonts-kacst-one \ | |
fonts-kalapi fonts-khmeros-core fonts-knda fonts-lao fonts-lklug-sinhala \ | |
fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva \ | |
fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym \ | |
fonts-lohit-orya fonts-lohit-taml fonts-lohit-taml-classical \ | |
fonts-lohit-telu fonts-mlym fonts-nakula fonts-navilu \ | |
fonts-noto-cjk fonts-noto-color-emoji fonts-orya fonts-orya-extra \ | |
fonts-pagul fonts-sahadeva fonts-samyak-deva fonts-samyak-gujr \ | |
fonts-samyak-mlym fonts-samyak-taml fonts-sarai fonts-sil-abyssinica \ | |
fonts-sil-padauk fonts-smc fonts-smc-anjalioldlipi fonts-smc-chilanka \ | |
fonts-smc-dyuthi fonts-smc-gayathri fonts-smc-karumbi fonts-smc-keraleeyam \ | |
fonts-smc-manjari fonts-smc-meera fonts-smc-rachana \ | |
fonts-smc-raghumalayalamsans fonts-smc-suruma fonts-smc-uroob \ | |
fonts-taml fonts-telu fonts-telu-extra fonts-thai-tlwg fonts-tibetan-machine \ | |
fonts-tlwg-garuda fonts-tlwg-garuda-ttf fonts-tlwg-kinnari \ | |
fonts-tlwg-kinnari-ttf fonts-tlwg-laksaman fonts-tlwg-laksaman-ttf \ | |
fonts-tlwg-loma fonts-tlwg-loma-ttf fonts-tlwg-mono fonts-tlwg-mono-ttf \ | |
fonts-tlwg-norasi fonts-tlwg-norasi-ttf fonts-tlwg-purisa \ | |
fonts-tlwg-purisa-ttf fonts-tlwg-sawasdee fonts-tlwg-sawasdee-ttf \ | |
fonts-tlwg-typewriter fonts-tlwg-typewriter-ttf fonts-tlwg-typist \ | |
fonts-tlwg-typist-ttf fonts-tlwg-typo fonts-tlwg-typo-ttf \ | |
fonts-tlwg-umpush fonts-tlwg-umpush-ttf fonts-tlwg-waree \ | |
fonts-tlwg-waree-ttf fonts-yrsa-rasa | |
# | |
# Removing fonts from the system that were installed with the LibreOffice | |
# upgrade to 7.0.1. These fonts will never be used. | |
sudo apt-get purge -y \ | |
fonts-crosextra-caladea \ | |
fonts-crosextra-carlito \ | |
fonts-linuxlibertine \ | |
fonts-sil-gentium \ | |
fonts-sil-gentium-basic | |
# | |
# Removing nonessential EMA and APJ language Noto fonts and leaving the ones | |
# used by: | |
# SuperTuxKart: NotoColorEmoji.ttf, NotoNaskhArabicUI-Regular.ttf, | |
# NotoSansHebrew-Regular.ttf, NotoSansThai-Regular.ttf | |
# Existing Noto fonts to keep: NotoSans-BoldItalic.ttf, NotoSans-Bold.ttf, | |
# NotoSans-Italic.ttf, NotoSans-Regular.ttf | |
echo " " | |
echo "Removing nonessential EMA and APJ language Noto fonts ..." | |
echo " " | |
# | |
SEARCH_FOLDER="/usr/share/fonts/truetype/noto/*" | |
for f in $SEARCH_FOLDER | |
do | |
if \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoNaskhArabicUI-Regular.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSans-BoldItalic.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSans-Bold.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSansHebrew-Regular.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSans-Italic.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf" ] || \ | |
[ "$f" = "/usr/share/fonts/truetype/noto/NotoSansThai-Regular.ttf" ] | |
then | |
continue | |
else | |
sudo rm -v "$f" | |
fi | |
done | |
echo " " | |
echo "Removing additional duplicated fonts ..." | |
echo " " | |
# Remove all the PFB, base 35 OTF and T1 files from the system. | |
sudo rm -v /usr/share/fonts/opentype/urw-base35/*.otf | |
sudo rm -v /usr/share/fonts/type1/gsfonts/*.pfb | |
sudo rm -v /usr/share/fonts/type1/urw-base35/*.t1 | |
sudo rm -v /usr/share/fonts/X11/Type1/*.pfb | |
# | |
# Remove duplicate Liberation Fonts, keeping the newer versions. | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSans-BoldItalic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSerif-BoldItalic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSerif-Italic.ttf | |
sudo rm -v /usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf | |
# | |
# Each of these directories contains a ".uuid" file which is why the | |
# directory is left over after font uninstallation. | |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897040 | |
echo " " | |
echo "Remove empty directories left after purging fonts ..." | |
echo " " | |
sudo rm -Rf -v /usr/share/fonts/opentype/linux-libertine/ | |
sudo rm -Rf -v /usr/share/fonts/opentype/malayalam/ | |
sudo rm -Rf -v /usr/share/fonts/opentype/noto | |
sudo rm -Rf -v /usr/share/fonts/opentype/urw-base35/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/abyssinica/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/crosextra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/droid/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-beng-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-deva-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-gujr-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-guru-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-kalapi/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-orya-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-telu-extra/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/fonts-yrsa-rasa/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Gargi/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/gentium/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/gentium-basic/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Gubbi/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/hack/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/kacst/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/kacst-one/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/lao/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/lohit-*/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/malayalam/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Nakula/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Navilu/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/openoffice/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/padauk/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/pagul/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Sahadeva/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/samyak/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/samyak-fonts/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/Sarai/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/sinhala/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/tibetan-machine/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/tlwg/ | |
sudo rm -Rf -v /usr/share/fonts/truetype/ttf-khmeros-core/ | |
# | |
############################################################################# | |
# Note: Font Manager will turn off local display of fonts in application # | |
# font lists without removing their dependencies and breaking packages. # | |
# Here is a list of the additional fonts blocked by Font Manager. # | |
# ------------------------------------------------------------------------- # | |
# Game packages: # | |
# Amiri, Amiri Quran, Amiri Quran Colored, Cantarell, # | |
# DejaVu Math TeX Gyre, LKLUG, Nakula, Noto Naskh Arabic UI, # | |
# TeX Gyre Adventor, TeX Gyre Bonum, TeX Gyre Bonum Math, TeX Gyre Chorus, # | |
# TeX Gyre Cursor, TeX Gyre DejaVu Math, TeX Gyre Heros, TeX Gyre Heros Cn, # | |
# TeX Gyre Pagella, TeX Gyre Pagella Math, TeX Gyre Schola, # | |
# TeX Gyre Schola Math, TeX Gyre Termes, TeX Gyre Termes Math, # | |
# WenQuanYi Micro Hei, WenQuanYi Micro Hei Mono. # | |
# ------------------------------------------------------------------------- # | |
# SDR packages: # | |
# Bitstream Vera Sans, Bitstream Vera Sans Mono, Bitstream Vera Serif, # | |
# cmex10, cmmi10, cmr10, cmsy10, esint10, eufm10, msam10, msbm10, # | |
# rsfs10, stmary10, wasy10 # | |
# ------------------------------------------------------------------------- # | |
# Copy 78-Reject.conf file over to the system. | |
if [ ! -e "/$HOME/.config/fontconfig/conf.d/" ] | |
then | |
mkdir -p ~/.config/fontconfig/conf.d | |
fi | |
cp /$MP/$DV/custom/font-manager/78-Reject.conf ~/.config/fontconfig/conf.d | |
# | |
# Copy configuration files of the Font Manager over to the system so Font | |
# Manager is configured and ready to go on first use. | |
if [ ! -e "/$HOME/.config/font-manager/" ] | |
then | |
mkdir -p ~/.config/font-manager | |
fi | |
cp /$MP/$DV/custom/font-manager/Collections.json ~/.config/font-manager | |
cp /$MP/$DV/custom/font-manager/Sources.xml ~/.config/font-manager | |
# | |
if [ ! -e "/$HOME/.cache/font-manager/" ] | |
then | |
mkdir -p ~/.cache/font-manager | |
fi | |
cp /$MP/$DV/custom/font-manager/font-manager.sqlite ~/.cache/font-manager | |
# | |
# Erase all existing font caches, then re-scan. System and Local. | |
echo " " | |
echo "Erase all existing font caches, then re-scan. System and Local ..." | |
echo " " | |
sudo fc-cache -rv && fc-cache -rv | |
# | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment