Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Fontconfig update in January 2023

Recently, package fontconfig updated to 2.14.1 in Debian and therefore Devuan.

Some default font selections changed, which caused my fonts to be taller and have more line spacing. Affected applications and components include xfce4-terminal (yes, yes, on Fluxbox; user freedom and all that...), the fluxbox menu, and gtk menus.

After some fruitless Internet searches, I decided to ask the smart people in #devuan. A smart fellow said this came up in the Debian forum, which led me to a Google Groups discussion which has a workaround.

I adapted the workaround into a single script because I like to make a single fix a single command. I could have made this check before modifying the file, but whatever. It is still idempotent.

#!/bin/sh
# Startdate: 2023-01-31-3 19:05
# Author: bgstack15
# Reference:
#    https://onlinexmltools.com/prettify-xml
#    Fontconfig file ripped off from Konomi
tf="/etc/fonts/conf.d/50-prefer-dejavu.conf"
sudo touch "${tf}" ; sudo tee "${tf}" 1>/dev/null <<EOF
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
    </prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer>
      <family>DejaVu Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>DejaVu Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>serif</family>
    <prefer>
      <family>DejaVu Serif</family>
    </prefer>
  </alias>
</fontconfig>
EOF
sudo fc-cache -r
echo "You might want to restart Xorg. Done."

Comments