User Tools

Site Tools


tips:how-to-fix-blurry-font-rendering-in-ubuntu

How to fix blurry font rendering in Ubuntu

By default, at least Ubuntu 10.04 comes with font rendering settings that enable antialiasing and hinting in such way that everything looks blurry and soft. With some fonts, the edge of the font also looks like it has a shadow that isn't gray in color but more like a shade of red, green or blue. Starting from Ubuntu 17.10, the font rendering also results in a wider blurring than before.

/etc/fonts/conf.d/99-fix-fonts.conf

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

Starting the file name with 99 will force the content to be sourced last when the configuration is read and as a result any settings in the file will override those set elsewhere. The lcdfilter setting seems to have the most effect and setting rgba to none will make the antialiasing to be grayscale instead of seamingly random colors. The documentation for this file is available here.

Additional changes for more recent FreeType versions

Starting from FreeType version 2.7, the hinting style has changed (see more detailed documentation. However, this results in more blur than with the previously used (v35 interpreter) solution causing again fonts to be less sharp. The older interpreter is still available and can be enabled with the following addition in, for example, /etc/environment or any other file where environment properties can be set before the X server is started:

FREETYPE_PROPERTIES="truetype:interpreter-version=35 cff:no-stem-darkening=1 autofitter:warping=1"

This change require the X server to be restarted or the system rebooted.

Xfce 4 Settings Manager -> Appearance -> Fonts

These setting will still affect those programs that don't use fontconfig for selecting font rendering settings. Note that the subpixel order is screen specific when using a TFT display. However, usually it's best to just try every option and see which one provides the most pleasable result. Selecting 'None' guarantees that the rendering doesn't cause colored edges. The purpose of the subpixel order is the same as lcdfilter in the /etc/fonts/conf.d example.

Before and after comparison

These images shows the difference between the default (left) and modified (right) settings.

Default (300% zoom) Modified (300% zoom)
tips/how-to-fix-blurry-font-rendering-in-ubuntu.txt · Last modified: 18.08.2018 22:30 by vergo