Skip to content

Instantly share code, notes, and snippets.

@probonopd
Last active July 28, 2025 13:32
Show Gist options
  • Save probonopd/5e417a7c80762e40f2d90762dfd41898 to your computer and use it in GitHub Desktop.
Save probonopd/5e417a7c80762e40f2d90762dfd41898 to your computer and use it in GitHub Desktop.

Liberate desktops from ugly fonts

Blocking unwanted fonts

Certain surrogate fonts have plagued open source desktops for way too long, making them all look ugly. Trying to uninstall them will lead to the package manager uninstalling other vital packages, and just deleting them will reinstate them on package updates. The clean solution is to block them in fontconfig.

On FreeBSD (Linux is similar, but without the "local" part):

sudo pkg install freefont-ttf

cat > ~/.config/fontconfig/fonts.conf <<\EOF
<fontconfig>
  <selectfont>
    <rejectfont>
      <glob>/usr/local/share/fonts/Liberation/*</glob>
      <glob>/usr/local/share/fonts/dejavu/*</glob>
      <glob>/usr/local/share/fonts/noto/*</glob>
      <glob>/usr/local/share/fonts/cantarell/*</glob>
      <glob>/usr/local/share/fonts/fonts-indic/*</glob>
      <glob>/usr/local/share/fonts/Droid/*</glob>
    </rejectfont>
  </selectfont>
</fontconfig>
EOF
fc-cache -fv

To make this system wide, put it in /usr/local/etc/fonts/conf.d/99-block-surrogate-fonts.conf.

Perplexity source

Replacing fonts

mkdir -p ~/.config/fontconfig/conf.d/
cat > ~/.config/fontconfig/conf.d/99-inter-for-helvetica.conf <<\EOF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match>
    <test name="family" compare="eq">
      <string>Helvetica</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Inter</string>
    </edit>
  </match>
</fontconfig>
EOF
fc-cache -fv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment