[xmonad] Help: How to disable font smoothing?

Adam Sampson ats at offog.org
Sun Dec 13 12:11:31 EST 2009

As others have mentioned, the easiest way to do this is just to run
the GNOME settings daemon (or the XFCE/KDE equivalent). If you don't
want to do that for some reason, then read on...

Yuliang Wang <jadelightking at gmail.com> writes:

> I prefer fonts not to be smoothed, so in gnome I use
> gnome-appearance-settings and set the smoothing option to 'none'
> (other options are 'gray scale' and 'subpixel'). How to configure
> those in xmonad?

The simple way is to set the corresponding X resources -- you're
probably after something like:

  Xft.antialias: 0
  Xft.hinting: 1
  Xft.hintstyle: hintfull
  Xft.rgba: rgb

This is what the GNOME settings system is actually doing underneath;
graphics toolkits like GTK and Qt then look at those resources to decide
how fonts should be rendered. (The usual place to put those lines is in
~/.Xresources, and you can load them into the X server by saying "xrdb
-merge ~/.Xresources".)

If you want to do something more complicated (e.g. you'd like to disable
antialiasing only for some fonts, or only beneath a certain size), you
can edit ~/.fonts.conf, which contains custom rules for the fontconfig
library that modern applications use to list and select fonts. If you
had a font called "Antenna" that you wanted to not be antialiased, then
you could say something like:

  <?xml version='1.0'?>
  <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>

    <match target="font">
      <test name="family"><string>Antenna</string></test>

      <edit name="antialias" mode="assign"><bool>false</bool></edit>
      <edit name="hinting" mode="assign"><bool>true</bool></edit>
      <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
      <edit name="rgba" mode="assign"><const>rgb</const></edit>


If you left out the <test ...> element, then it'd apply to all fonts,
and thus have more or less the same effect as the resources above, with
the exception that it'll also work on old versions of Qt that don't
parse the Xft resources properly; this is unlikely to be a problem on a
modern system.

> [...] how to set the background and text colors of applications in
> general?

For GTK applications, you can specify the font and theme by putting
something like this in ~/.gtkrc-2.0:

  gtk-font-name = "Liberation Sans 11"
  gtk-theme-name = "Xfce-curve"

Adam Sampson <ats at offog.org>                         <http://offog.org/>

More information about the xmonad mailing list