Why is Xft ignoring font settings

fontconfigfontsxft

As you can see below, my Xft settings match exactly my fontconfig settings:

$ xrdb -query | grep -i xft
Xft.antialias:  1
Xft.autohint:   1
Xft.dpi:    96
Xft.hinting:    1
Xft.hintstyle:  hintmedium
Xft.lcdfilter:  lcddefault
Xft.rgba:   none

$ fc-match --verbose :family=Mono:size=12 | grep '^.\(hint\|anti\|auto\|dpi\|rgba\|lcd\)'
    antialias: True(w)
    hintstyle: 2(i)(w)
    hinting: True(w)
    autohint: True(w)
    dpi: 96(f)(w)
    rgba: 5(i)(w)
    lcdfilter: 1(i)(w)

Unfortunately Xft seems to be ignoring these settings, and is doing no hinting at all. I can see this in GUI Emacs or running the command

pango-view --backend=xft --font='Mono, 12' -t 'Xft - X FreeType interface library'

enter image description here

Compare the rendering with the one produced by the Cairo backend:

pango-view --backend=cairo --font='Mono, 12' -t 'Xft - X FreeType interface library'

enter image description here

Best Answer

It turns out that in Xft hintmedium is a synonym for hintslight, whereas in fontconfig hintmedium is a synonym for hintfull. Therefore the option hintmedium actually selects a different hinting method depending on whether the program uses Cairo or Xft.

This is not documented anywhere, as far as I know. I have had to figure it out by trial and error.

Related Question