Like it!

Join me on Facebook!

Like it!

Fixing ugly fonts in Chrome/Chromium with Debian Xfce

No more jagged garbage and horrible kerning thanks to a small configuration file.

During the installation of Debian testing + Xfce, both latest versions, I experienced a horrible font rendering for the entire desktop. Tweaking the font settings by removing hinting solved the issue for most of the applications, except for Chrome and Chromium.

What really worked for me was adding a small configuration file for Fontconfig in my home directory. Put the following XML in ~/.fonts.conf (create the file if it does not exist):

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
  </match>
  <match target="font">
    <edit name="hintstyle" mode="assign"><const>hintnone</const></edit>
  </match>
  <match target="font">
   <edit mode="assign" name="hinting"><bool>false</bool></edit>
  </match>
</fontconfig>

With that piece of XML we are basically telling Fontconfig to disable hinting for any font in the system, but leaving antialias on.

Quoting from the official Fontconfig website:

fonts.conf contains configuration information for the fontconfig library consisting of directories to look at for font information as well as instructions on editing program specified font patterns before attempting to match the available fonts.

It seems that the Appearance manager in Xfce does not fully configure the environment. Restart Chrome/Chromium and your font rendering issue should be fixed.

Is ~/.fonts.conf deprecated?

Recently I faced a new warning:

Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated. please move it to /home/[your-home]/.config/fontconfig/fonts.conf manually

which basically means that putting the font configuration in ~/.fonts.conf is now deprecated and no longer supported in the future. Just move that file into /home/[your-home]/.config/fontconfig/ and everything will be fine.

Sources

Fontconfig @ freedesktop.org

comments
James on June 27, 2018 at 17:45
Genius! Works perfectly for xfce on centos7 also! many thanks!
Ben in Seattle on October 10, 2018 at 23:09
Good suggestion, but not working for me for some fonts. For example, the following looks fine in Firefox butnot Chromium, regardless of the fonts.conf file: https://azure.microsoft.com/en-us/blog/microsoft-joins-open-invention-network-to-help-protect-linux-and-open-source/