Announcement

Collapse
No announcement yet.

removal of unused Fonts?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [CONFIGURATION] removal of unused Fonts?

    Is 24.04 sensitive to the script going around to remove unused Fonts? I used it in 23.10 with no issues.
    Last edited by James the Third; May 29, 2024, 08:04 PM. Reason: reviewed script as suggested and saw my memory was leaking.

    #2
    You would have to post the exact contents of "the script going around" to get a reasonable answer.


    PS: I would also generally strongly advise anyone not to use/run any "scripts from the internet" that don't come from trustworthy sources or whose contents have not been verified and understood by yourself or a person that has the ability to do this (that is one of the "general rules" regarding computer security - no matter which operating system you use).
    Last edited by Schwarzer Kater; May 29, 2024, 11:20 AM. Reason: added PS
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #3
      Sorry. Mistake in title of first topic. It should be alien fonts not languages.

      Code:
        
      # purge-alien-loc.sh - V. 1.1.0
      # Remove oriental/medio-oriental/african/etc. fonts
      # + Libreoffice localization not of use in IT/GB/USA
      #
      # Author: Rik - www.riksoft.it
      # Licence: LGPL
      #
      # Changelog
      # 1.1.0 Added fonts-teluguvijayam
      
      #--------- CONFIG ------------------------------
      
      # localisations to keep (pipe separated)
      KEEP="en-gb|en-us|it"
      
      #-----------------------------------------------
      
      
      
      
      sudo apt update
      
      # Remove all oriental/arabic/asian fonts in Debian/Ubuntu/Mint
      
      fonts="fonts-kacst fonts-kacst-one fonts-khmeros-core fonts-lklug-sinhala fonts-guru fonts-nanum fonts-noto-cjk"
      fonts="$fonts fonts-takao-pgothic fonts-tibetan-machine fonts-guru-extra fonts-lao fonts-sil-padauk fonts-sil-abyssinica"
      fonts="$fonts fonts-tlwg-* fonts-lohit-* fonts-beng fonts-beng-extra fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra"
      fonts="$fonts fonts-kalapi fonts-lohit-gujr fonts-samyak-* fonts-noto-unhinted fonts-noto-hinted fonts-navilu fonts-nakula"
      fonts="$fonts fonts-orya-extra fonts-pagul fonts-sahadeva fonts-sarai fonts-smc fonts-telu-extra fonts-wqy-microhei"
      fonts="$fonts fonts-hosny-amiri fonts-smc-anjalioldlipi fonts-sil-andika fonts-arphic-ukai fonts-arphic-uming"
      fonts="$fonts fonts-sipa-arundina fonts-bpg-georgian fonts-khmeros fonts-smc-chilanka fonts-smc-* fonts-noto-ui-extra"
      fonts="$fonts fonts-noto-ui-core fonts-noto-extra fonts-noto-core culmus fonts-ipafont fonts-ipafont-*"
      fonts="$fonts fonts-farsiweb fonts-hosny-thabit fonts-ukij-uyghur fonts-yrsa-rasa fonts-sil-scheherazade"
      fonts="$fonts fonts-unikurdweb fonts-dzongkha fonts-deva-extra fonts-teluguvijayam"
      
      IFS=' ' read -ra aFonts <<< "$fonts"
      
      for font in "${aFonts[@]}"; do
      sudo apt purge -y $font
      done
      
      
      
      #remove orphans/rubbish
      sudo rm -r /usr/share/fonts/opentype/fonts-hosny-amiri \
      /usr/share/fonts/truetype/andika \
      /usr/share/fonts/truetype/arphic \
      /usr/share/fonts/truetype/arundina \
      /usr/share/fonts/truetype/fonts-bpg-georgian \
      /usr/share/fonts/truetype/khmeros \
      /usr/share/fonts/opentype/malayalam \
      /usr/share/fonts/truetype/malayalam \
      /usr/share/fonts/truetype/malayalam \
      /usr/share/fonts/truetype/culmus \
      /usr/share/fonts/opentype/ipafont-gothic \
      /usr/share/fonts/opentype/ipafont-mincho \
      /usr/share/fonts/truetype/farsiweb \
      /usr/share/fonts/opentype/fonts-hosny-thabit \
      /usr/share/fonts/truetype/fonts-ukij-uyghur \
      /usr/share/fonts/truetype/fonts-yrsa-rasa \
      /usr/share/fonts/truetype/scheherazade \
      /usr/share/fonts/truetype/unikurdweb \
      /usr/share/fonts/truetype/dzongkha \
      /usr/share/fonts/truetype/fonts-deva-extra \
      /usr/share/doc/fonts-teluguvijayam \
      /usr/share/fonts/truetype/teluguvijayam
      
      
      echo "==== Fixing font cache"
      sudo fc-cache -f -v && sudo dpkg-reconfigure fontconfig
      
      echo "==== Packages left (each containing multiple fonts)"
      sudo dpkg -l fonts\*|grep ^ii|awk '{print $2}'
      
      
      
      
      echo
      echo "We are going to remove Libreoffice Help in any language except $KEEP"
      read -p "Press CTRL+C to interrupt, return to continue."
      
      #unfortunately this one-liner cannot be used :-(
      #because bash doesn't support lookahead
      #sudo apt purge '^libreoffice-help-(?!it|en)[a-z]{2}(-[a-z]{2})?$'
      #... so... I'll go this way
      #sudo apt purge '^libreoffice-help-[a-z]{2,3}(-[a-z]{2})?$'
      #sudo apt install libreoffice-help-en-gb libreoffice-help-en-us libreoffice-help-it
      #or more cleaner/secure as follows...
      
      list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^libreoffice-help-[a-z]{2,3}(-[a-z]{2})?$')
      for pkg in $list; do
      if [[ "$pkg" =~ ^(libreoffice-help-($KEEP))$ ]]; then
      echo "Skipping $pkg"
      else
      sudo apt purge -y "$pkg"
      fi
      done
      
      
      
      
      echo
      echo "We are going to remove Libreoffice locales except $KEEP"
      read -p "Press CTRL+C to interrupt, return to continue."
      
      #sudo apt remove '^libreoffice-l10n-[a-z]{2,3}(-[a-z]{2})?$'
      #sudo apt install libreoffice-l10n-en-gb libreoffice-l10n-it
      #Safer as follows...
      
      list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^libreoffice-l10n-[a-z]{2,3}(-[a-z]{2})?$')
      for pkg in $list; do
      if [[ "$pkg" =~ ^(libreoffice-l10n-($KEEP))$ ]]; then
      echo "Skipping $pkg"
      else
      sudo apt purge -y "$pkg"
      fi
      done
      
      
      
      
      
      echo
      echo "Firefox is bound to Libreoffice locales so apt will"
      echo "cope installing the missing locales for Firefox."
      echo "We are going to remove them as well, except for $KEEP."
      read -p "Press CTRL+C to interrupt, return to continue."
      
      #sudo apt remove '^firefox-esr-l10n-[a-z]{2,3}(-[a-z]{2})?$'
      #sudo apt install firefox-esr-l10n-en-gb firefox-esr-l10n-it
      #Safer as follows...
      
      list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^firefox-esr-l10n-[a-z]{2,3}(-[a-z]{2})?$')
      for pkg in $list; do
      if [[ "$pkg" =~ ^(firefox-esr-l10n-($KEEP))$ ]]; then
      echo "Skipping $pkg"
      else
      sudo apt purge -y "$pkg"
      fi
      done
      
      
      
      # This could be implemented as well, leaving only the interested languages...
      #task-*-desktop
      
      
      sudo apt autoremove
      
      read -p "Press any key to close."  ​

      Comment


        #4
        I would not use this script in Kubuntu 24.04 LTS as it will also remove something like fonts-noto-core… One might need this to display certain languages.

        Additionally the script as posted will only keep English (British), English (US) and Italian language and help packages for LibreOffice and delete every other language support for LO!

        It also tries to remove Firefox ESR (not available at all in Kubuntu 24.04 LTS) language files.
        "echo "Firefox is bound to Libreoffice locales so apt will"[…]" - no it isn't in Kubuntu


        --> What exactly is your problem with fonts in Kubuntu 24.04 LTS?
        Perhaps it would be better to find a solution for your problem instead of running this script…
        Last edited by Schwarzer Kater; May 30, 2024, 05:35 AM.
        Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
        Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

        get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
        install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

        Comment


          #5
          Hello, I in agreement with the author that I have too many choices for my uses.
          "but most of all, when you have to choose a font it's a lot easier/faster."

          Comment

          Working...
          X