Are there any ways to improve the font rendering in X11.app / XQuartz

fontx11xquartz

I use WingIDE for Python development and it runs under X Windows. The X11 font rendering is driving me crazy. Are there any tricks for getting better fonts in an X Server on MacOS / Lion? Sample image here. It's not so bad that I'd say it's broken, but the hinting, subpixel rendering, etc all just doesn't look nearly as nice in the X server as it does in MacOS native.

I've installed XQuartz 2.7.0 binaries by hand and didn't notice any improvement in font rendering. I also tried copying Menlo.ttc into my ~/.fonts directory to have a nicer font than the X windows fonts but it's clear the X font renderer just can't match MacOS native. This 2005 OpenOffice tips article recommends replacing libfreetype but it's a pretty awkward process I haven't tried given the age of the instructions.

Best Answer

Warning: this is not my final answer, it will take some time to provide a better one.

Tested on OS X 10.8.5 with XQuartz 2.7.4 (xorg-server 1.13.0) and:

  • meld - installed via brew install meld
  • xterm
  • xclock

To tune the fonts create a file ~/.Xresources and put this:

Xft.dpi:        96
Xft.antialias:  true
Xft.hinting:    true
Xft.autohint:   true
Xft.rgba:       rgb
Xft.hintstyle:  hintfull

XTerm*faceName: DejaVu Sans Mono
*faceName: DejaVu Sans Mono

Inside ~/.gtkrc-2.0:

style "user-font" {
    font_name = "Lucida Grande 10"
}
widget_class "*" style "user-font"

gtk-font-name="Lucida Grande 10"
gtk-enable-mnemonics = 0

Feel free to post your modifications, as long they are using standard Fonts available on OS X, I would like to make this drop-in recipe.

The last file has an effect on meld and other gtk apps.

Note, the font is the same as the one used in OS X UI but the rendering is still a little bit different.