probonopd / system

Ubuntu Live ISO customizer
2 stars 1 forks source link

Remove remaining unwanted fonts #2

Open probonopd opened 4 years ago

probonopd commented 4 years ago

https://github.com/probonopd/system/blob/f52f9db31f9bf6d81710bfbc10ae3eb58dca8171/remaster.sh#L53-L54

Objective: Only fonts-ubuntu should be installed, and fonts that will proactively be chosen.

probonopd commented 4 years ago

It is really liberating to see all the font bloat gone. I would also like to remove those Bitstream ones, only leaving URW and Ubuntu.

menu

probonopd commented 4 years ago

I do not want ttf-bitstream-vera fonts-dejavu-core fonts-liberation. Those have reigned the looks of our Linux desktops for far too long.

Are those fonts hardwired into the desktop? How can they be replaced?

me@host:~$ sudo apt-get remove ttf-bitstream-vera fonts-dejavu-core fonts-liberation
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'ttf-bitstream-vera' is not installed, so not removed
Package 'fonts-liberation' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  aptdaemon aptdaemon-data aspell aspell-en atril-common avahi-utils bluez-obexd bubblewrap cheese-common colord-data cups-browsed
  cups-daemon cups-ipp-utils cups-pk-helper cups-server-common dc dictionaries-common diffstat emacsen-common enchant
  engrampa-common freepats gdisk gettext gir1.2-atk-1.0 gir1.2-atspi-2.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gmenu-3.0
  gir1.2-goa-1.0 gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-javascriptcoregtk-4.0 gir1.2-json-1.0 gir1.2-nm-1.0
  gir1.2-notify-0.7 gir1.2-packagekitglib-1.0 gir1.2-polkit-1.0 gir1.2-secret-1 gir1.2-snapd-1 gir1.2-soup-2.4 gir1.2-xkl-1.0
  gnome-desktop3-data gnome-keyring-pkcs11 gnome-menus gnome-software-common gnome-themes-extra-data gsfonts gstreamer1.0-gl
  gtk-update-icon-cache gvfs-common gvfs-libs hicolor-icon-theme hplip-data hunspell-en-us i965-va-driver imagemagick-6-common
  intltool-debian ippusbxd libaa1 libaacs0 libapt-pkg-perl libarchive-zip-perl libart-2.0-2 libaspell15 libatasmart4
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatkmm-1.6-1v5 libavahi-glib1 libavc1394-0 libavresample3 libavutil55 libbdplus0
  libblockdev-crypto2 libblockdev-fs2 libblockdev-loop2 libblockdev-part-err2 libblockdev-part2 libblockdev-swap2 libblockdev-utils2
  libblockdev2 libbrotli1 libbs2b0 libburn4 libcaca0 libcanberra0 libcdio-cdda2 libcdio-paranoia2 libcdio17 libcdparanoia0
  libcgi-fast-perl libcgi-pm-perl libclass-accessor-perl libclone-perl libclutter-1.0-common libcogl-common libcolord2 libcolorhug2
  libcroco3 libcrystalhd3 libcupscgi1 libcupsmime1 libdatrie1 libdbusmenu-glib4 libdc1394-22 libdca0 libde265-0 libdjvulibre-text
  libdjvulibre21 libdv4 libdvdnav4 libdvdread4 libemail-valid-perl libenchant1c2a libevent-2.1-6 libexo-common libexo-helpers
  libexporter-tiny-perl libfaad2 libfcgi-perl libfftw3-double3 libflite1 libfluidsynth1 libfontembed1 libgarcon-common libgck-1-0
  libgcr-base-3-1 libgdata-common libgdata22 libgee-0.8-2 libgl1-mesa-glx libglib-object-introspection-perl libglib-perl
  libglibmm-2.4-1v5 libglu1-mesa libgme0 libgnome-games-support-common libgnome-menu-3-0 libgoa-1.0-0b libgoa-1.0-common
  libgphoto2-l10n libgphoto2-port12 libgraphene-1.0-0 libgraphite2-3 libgs9-common libgsm1 libgspell-1-common libgssdp-1.0-3
  libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-good1.0-0 libgtk-3-common libgtk2.0-common
  libgtksourceview-3.0-common libgupnp-1.0-4 libgupnp-igd-1.0-4 libgutenprint2 libharfbuzz-icu0 libharfbuzz0b libhpmud0
  libhunspell-1.6-0 libhyphen0 libical3 libiec61883-0 libieee1284-3 libilmbase12 libimobiledevice6 libio-pty-perl libio-string-perl
  libipc-run-perl libisofs6 libjavascriptcoregtk-4.0-18 libjbig2dec0 libjte1 libkate1 libkpathsea6 liblcms2-2 liblcms2-utils
  liblightdm-gobject-1-0 liblilv-0-0 liblist-moreutils-perl liblouis-data liblouis14 liblouisutdml-bin liblouisutdml-data
  liblouisutdml8 liblqr-1-0 libminiupnpc10 libmjpegutils-2.1-0 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpeg2encpp-2.1-0
  libmpg123-0 libmplex2-2.1-0 libmtp-common libmtp-runtime libmtp9 libmysofa0 libnatpmp1 libnet-dns-perl libnet-domain-tld-perl
  libnet-ip-perl libnetpbm10 libnice10 libnorm1 libnspr4 libnss3 liboauth0 libofa0 liboobs-1-5 libopenal-data libopenal1
  libopenexr22 libopenjp2-7 libopenmpt0 libopus0 libpaper-utils libpaper1 libparse-debianchangelog-perl libparted-fs-resize0
  libperlio-gzip-perl libpgm-5.2-0 libplist3 libpostproc54 libpulse-mainloop-glib0 libqpdf21 libqqwing2v5 libraw1394-11
  librest-0.7-0 librubberband2 libsane-common libsane-hpaio libsbc1 libsecret-1-0 libsecret-common libserd-0-0 libshine3
  libsigc++-2.0-0v5 libsmbclient libsnapd-glib1 libsnappy1v5 libsnmp-base libsnmp30 libsodium23 libsord-0-0 libsoundtouch1
  libsoup-gnome2.4-1 libsoxr0 libspandsp2 libspeex1 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libstartup-notification0 libswresample2
  libswscale4 libtag1v5 libtag1v5-vanilla libtagc0 libtext-levenshtein-perl libthai-data libthai0 libtimezonemap-data libtumbler-1-0
  libtwolame0 libudisks2-0 libupower-glib3 libusbmuxd4 libutempter0 libv4l-0 libv4lconvert0 libva-drm2 libva-x11-2 libva2 libvdpau1
  libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvolume-key1 libvorbisfile3 libvpx5 libvte-2.91-common libvulkan1 libwavpack1
  libwayland-cursor0 libwayland-egl1 libwayland-egl1-mesa libwebp6 libwebpdemux2 libwebpmux3 libwildmidi-config libwildmidi2
  libwmf0.2-7 libwnck-3-common libwnck-common libwoff1 libx264-152 libx265-146 libxcb-render0 libxcb-shape0 libxcb-shm0
  libxcomposite1 libxfce4ui-common libxfce4util-bin libxfce4util-common libxfce4util7 libxfconf-0-2 libxkbcommon0 libxklavier16
  libxml-libxml-perl libxml-namespacesupport-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl
  libxnvctrl0 libxres1 libxslt1.1 libxvidcore4 libxxf86dga1 libyaml-libyaml-perl libzbar0 libzmq5 libzvbi-common libzvbi0 lintian
  mate-calc-common mate-desktop-common mesa-va-drivers mesa-vdpau-drivers mobile-broadband-provider-info mscompress netpbm
  onboard-common p11-kit p11-kit-modules p7zip p7zip-full patchutils pkg-config poppler-data printer-driver-foo2zjs-common
  pulseaudio-module-bluetooth python3-aptdaemon python3-cups python3-cupshelpers python3-dateutil python3-debconf python3-debian
  python3-defer python3-olefile python3-pexpect python3-pil python3-psutil python3-ptyprocess python3-renderpm python3-reportlab
  python3-reportlab-accel python3-software-properties python3-xcffib qpdf session-migration software-properties-common
  sound-theme-freedesktop ssl-cert system-config-printer-udev system-tools-backends t1utils thunar-data transmission-common
  tumbler-common udisks2 unattended-upgrades update-notifier-common upower usbmuxd va-driver-all vdpau-driver-all x11-session-utils
  xbitmaps xfce4-power-manager-data xfconf xfdesktop4-data xinit xubuntu-icon-theme xubuntu-wallpapers yelp-xsl zenity-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  cups-bsd cups-client cups-common cups-daemon cups-ipp-utils cups-server-common foomatic-filters gir1.2-javascriptcoregtk-4.0
  gnome-software-common libcups2 libcupscgi1 libcupsimage2 libcupsmime1 libcupsppdc1 libjavascriptcoregtk-4.0-18 pinentry-curses
  python3-apport python3-update-manager update-manager-core
Suggested packages:
  cups inetutils-inetd | inet-superserver xpp smbclient cups-filters poppler-utils ghostscript printer-driver-gutenprint
  printer-driver-hpcups hplip cups-pdf pinentry-doc
Recommended packages:
  colord ghostscript paps | cups | enscript | a2ps poppler-utils
The following packages will be REMOVED:
  adwaita-icon-theme apport-gtk blueman bluez-cups catfish colord cups cups-core-drivers cups-filters cups-filters-core-drivers
  engrampa exo-utils firefox fontconfig fontconfig-config fonts-dejavu-core gcr ghostscript ghostscript-x gir1.2-appindicator3-0.1
  gir1.2-cheese-3.0 gir1.2-clutter-1.0 gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gir1.2-gtk-3.0 gir1.2-gtkclutter-1.0 gir1.2-nma-1.0
  gir1.2-pango-1.0 gir1.2-timezonemap-1.0 gir1.2-vte-2.91 gir1.2-webkit2-4.0 gir1.2-wnck-3.0 gnome-font-viewer gnome-icon-theme
  gnome-keyring gnome-mines gnome-software gnome-software-plugin-snap gnome-sudoku gnome-system-tools gnome-themes-extra
  gnome-themes-standard gparted greybird-gtk-theme gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base
  gstreamer1.0-plugins-good gstreamer1.0-x gtk2-engines-murrine gtk2-engines-pixbuf gucharmap gvfs gvfs-backends gvfs-daemons
  gvfs-fuse hplip humanity-icon-theme imagemagick imagemagick-6.q16 language-selector-gnome libappindicator3-1 libass9 libavcodec57
  libavfilter6 libavformat57 libbluray2 libcairo-gobject-perl libcairo-gobject2 libcairo-perl libcairo2 libcairomm-1.0-1v5
  libcaja-extension1 libcanberra-gtk3-0 libcanberra-gtk3-module libcheese8 libchromaprint1 libclutter-1.0-0 libclutter-gst-3.0-0
  libclutter-gtk-1.0-0 libcogl-pango20 libcogl-path20 libcogl20 libdbusmenu-gtk3-4 libdbusmenu-gtk4 libexo-1-0 libexo-2-0
  libfontconfig1 libgail-common libgail18 libgarcon-1-0 libgcr-ui-3-1 libgd3 libgnome-desktop-3-17 libgnome-games-support-1-3
  libgphoto2-6 libgs9 libgspell-1-1 libgtk-3-0 libgtk-3-bin libgtk2.0-0 libgtk2.0-bin libgtk3-perl libgtkmm-2.4-1v5 libgtkmm-3.0-1v5
  libgtksourceview-3.0-1 libgucharmap-2-90-7 libgxps2 libido3-0.1-0 libindicator3-7 libkeybinder-3.0-0 libmagickcore-6.q16-3
  libmagickcore-6.q16-3-extra libmagickwand-6.q16-3 libnma0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpangomm-1.4-1v5
  libpangoxft-1.0-0 libpoppler-glib8 libpoppler73 librsvg2-2 librsvg2-common libsane1 libshout3 libspectre1 libtheora0
  libthunarx-2-0 libtimezonemap1 libunique-1.0-0 libvte-2.91-0 libwebkit2gtk-4.0-37 libwnck-3-0 libwnck22 libxfce4panel-2.0-4
  libxfce4ui-1-0 libxfce4ui-2-0 libxfce4ui-utils libxfcegui4-4 libxft2 libyelp0 light-locker lightdm-gtk-greeter
  lightdm-gtk-greeter-settings mate-calc menulibre mousepad mugshot network-manager-gnome network-manager-pptp-gnome numix-gtk-theme
  nvidia-settings onboard onboard-data orage parole pavucontrol pinentry-gnome3 pinentry-gtk2 plymouth-label
  plymouth-theme-xubuntu-logo policykit-1-gnome poppler-utils printer-driver-foo2zjs printer-driver-gutenprint printer-driver-hpcups
  printer-driver-pnm2ppa printer-driver-postscript-hp printer-driver-ptouch printer-driver-sag-gdi printer-driver-splix
  python3-aptdaemon.gtk3widgets python3-cairo python3-gi-cairo ristretto sane-utils screen-resolution-extra sgt-launcher sgt-puzzles
  shimmer-themes simple-scan software-properties-gtk system-config-printer system-config-printer-common thunar thunar-archive-plugin
  thunar-media-tags-plugin thunar-volman transmission-gtk tumbler ubiquity ubiquity-frontend-gtk ubuntu-mono
  ubuntu-release-upgrader-gtk update-manager update-notifier x11-apps x11-utils xdg-user-dirs-gtk xfburn xfce4-appfinder
  xfce4-cpugraph-plugin xfce4-dict xfce4-indicator-plugin xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-notes xfce4-notes-plugin
  xfce4-notifyd xfce4-panel xfce4-places-plugin xfce4-power-manager xfce4-power-manager-plugins xfce4-pulseaudio-plugin
  xfce4-quicklauncher-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-statusnotifier-plugin xfce4-systemload-plugin
  xfce4-taskmanager xfce4-terminal xfce4-verve-plugin xfce4-weather-plugin xfce4-whiskermenu-plugin xfce4-xkb-plugin xfdesktop4
  xfpanel-switch xfwm4 xorg xterm xubuntu-artwork yelp zenity
The following NEW packages will be installed:
  foomatic-filters pinentry-curses
The following packages will be upgraded:
  cups-bsd cups-client cups-common cups-daemon cups-ipp-utils cups-server-common gir1.2-javascriptcoregtk-4.0 gnome-software-common
  libcups2 libcupscgi1 libcupsimage2 libcupsmime1 libcupsppdc1 libjavascriptcoregtk-4.0-18 python3-apport python3-update-manager
  update-manager-core
17 upgraded, 2 newly installed, 235 to remove and 125 not upgraded.
Need to get 9,640 kB of archives.
After this operation, 609 MB disk space will be freed.
Do you want to continue? [Y/n] 
probonopd commented 4 years ago

Possibly by installing the package and then deleting the installed files from the system, and setting up font substitution. So that whenever someone has specified e.g., Liberation Sans, then something else is automatically used.


This is especially unwanted:

me@host:/isodevice/boot/iso$ fc-match Helvetica
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"

It means that if someone specified Helvetica, then Liberation Sans gets used despite the much more suitable Nimbus Sans L being available on the system.


But we want to go one step further and never use the unwanted fonts such as Liberation, even if they have been specified.

Check /etc/fonts/conf.avail/30-metric-aliases.conf and /etc/fonts/conf.avail/45-latin.conf.

cat > ~/.fonts.conf <<\EOF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>Liberation Sans</string></test>
    <edit name="family" mode="assign" binding="same"><string>Nimbus Sans L</string></edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family"><string>DejaVu Sans</string></test>
    <edit name="family" mode="assign" binding="same"><string>Nimbus Sans L</string></edit>
  </match>

<selectfont>
    <rejectfont>
        <pattern>
            <patelt name="family" >
                <string>Liberation Sans</string>
            </patelt>
        </pattern>
    </rejectfont>
</selectfont>

<selectfont>
    <rejectfont>
        <pattern>
            <patelt name="family" >
                <string>DejaVu Sans</string>
            </patelt>
        </pattern>
    </rejectfont>
</selectfont>

  <match target="pattern">
    <test qual="any" name="family"><string>Liberation Serif</string></test>
    <edit name="family" mode="assign" binding="same"><string>Nimbus Roman No9 L</string></edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family"><string>DejaVu Serif</string></test>
    <edit name="family" mode="assign" binding="same"><string>Nimbus Roman No9 L</string></edit>
  </match>

<selectfont>
    <rejectfont>
        <pattern>
            <patelt name="family" >
                <string>Liberation Serif</string>
            </patelt>
        </pattern>
    </rejectfont>
</selectfont>

<selectfont>
    <rejectfont>
        <pattern>
            <patelt name="family" >
                <string>DejaVu Serif</string>
            </patelt>
        </pattern>
    </rejectfont>
</selectfont>

</fontconfig>
EOF

Check that it is working:

me@host:~$ fc-match Helvetica
n019003l.pfb: "Nimbus Sans L" "Regular"
me@host:~$ fc-match Times
n021003l.pfb: "Nimbus Roman No9 L" "Regular"

me@host:~$ fc-match Sans
n019003l.pfb: "Nimbus Sans L" "Regular"
me@host:~$ fc-match Serif
n021003l.pfb: "Nimbus Roman No9 L" "Regular"

me@host:~$ fc-match Arial
n019003l.pfb: "Nimbus Sans L" "Regular"
me@host:~$ fc-match "Times New Roman"
n021003l.pfb: "Nimbus Roman No9 L" "Regular"

me@host:~$ fc-match "Liberation Sans"
n019003l.pfb: "Nimbus Sans L" "Regular"
me@host:~$ fc-match "Liberation Serif"
n021003l.pfb: "Nimbus Roman No9 L" "Regular"

me@host:~$ fc-match "DejaVu Sans"
n019003l.pfb: "Nimbus Sans L" "Regular"
me@host:~$ fc-match "DejaVu Serif"
n021003l.pfb: "Nimbus Roman No9 L" "Regular"

If we do this, then fc-match --verbose Sans does not give us the unwanted fonts anymore. And in the browser, I have the wanted instead of the unwanted sans serif fonts.

probonopd commented 4 years ago
# Remove "font spam"
# PLEASE NOTE: This might be a little "too much" because after this, Chinese characters
# and "line art"  will not be displayed anymore. 
# So we may want to be a bit more selective about this.

sudo find /usr/share/fonts/*type/ -mindepth 1 -type d -not -name openoffice -or -type l -delete

# Get "quality fonts"

# URW Core 35
wget -c "https://github.com/URWTypeFoundry/Core_35/archive/master.zip" -O Core_35.zip
unzip -o Core_35.zip  *[.otf]
sudo mkdir -p /usr/share/fonts/opentype/urwcore35
sudo mv  /tmp/Core_35-master/*.otf /usr/share/fonts/opentype/urwcore35/

# urwfonts
wget -c "https://fossies.org/linux/misc/old/ghost/AFPL/GhostPCL/urwfonts-8.71.tar.gz"
tar xf urwfonts-*.tar.gz
c
sudo mv urwfonts-* /usr/share/fonts/opentype/

# Adobe Source
wget -c "https://github.com/adobe-fonts/source-serif-pro/releases/download/3.001R/source-serif-pro-3.001R.zip"
wget -c "https://github.com/adobe-fonts/source-sans-pro/releases/download/3.006R/source-sans-pro-3.006R.zip"
unzip source-serif-pro-*.zip
unzip source-sans-pro-*.zip
wget -c "https://github.com/adobe-fonts/source-code-pro/releases/download/variable-fonts/SourceCodeVariable-Roman.otf"
wget -c "https://github.com/adobe-fonts/source-code-pro/releases/download/variable-fonts/SourceCodeVariable-Italic.otf"
sudo mkdir -p /usr/share/fonts/opentype/adobe
sudo find . -type f -name "Source*.otf" -exec mv {} /usr/share/fonts/opentype/adobe/ \;