# Configuring fonts for xterm, urxvt, emacs and others

I've recently started using xmonad as my window manager. I also decided to use urxvt as the default terminal, since it is supposed to be lightweight.

Most applications that give a font configuration option allow me to choose a font face (such as Arial, Consolas, FreeMono, Dejavu Sans etc.), and to set the size in pixels (11px, 12px or whatever). This is easy to understand.

Now when trying to set up the fonts for applications like xterm, urxvt and emacs among others, I have to come up with a rather strange string that looks something like: "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*" or "-unknown-DejaVu Sans Mono-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1"

I have used the xfontsel program to generate this for me, using trial and error. But I don't really understand what it means, or why it is necessary.

In addition, I have also used stuff like this: URxvt.font: 9x15bold.

My questions:

• What is the strange long string for configuring fonts?
• What does stuff like 9x15bold mean? How does it all come together?
• Why not stick to the conventional way of setting fonts like most other applications use?
• Why don't xterm and urxvt fonts look as good as, say, gnome-terminal fonts? Is there any way of achieving this?
-

1. It's an X logical font description, used mostly by pure-Xlib programs.

2. "9x15bold" is just a self-descriptive name for a bitmap font that comes with X.org. It doesn't mean anything to the software.

3. Xresources is the conventional way. Or at least, used to be. For example, one could set the font for one program with URxvt.font, or for everything with *font, and this would affect all programs – including even those run on a remote server. (X11 is a network protocol.)

Most newly-written programs use systems such as dconf in GNOME, which is fine, because they were written specifically for GNOME. Xterm, however, is desktop environment-agnostic, because – most importantly – it was created long before KDE and GNOME and Qt and GTK; it is part of the core X11 software suite. Thus it sticks to Xresources because it's simple and standard, with no dependencies on third-party libraries or services. (It has its disadvantages, of course, such as the lack of real-time reconfiguration.)

4. Xterm is a pure Xlib program and uses the font rendering provided by X11, while GNOME Terminal, being written with GTK, uses Freetype (via Pango).

However, recent versions of Xterm and URxvt include support for basic Freetype font rendering via Xft (has less features than Pango, e.g. lacks font fallback, but often is "good enough"). You can use it by adding these resources:

URxvt.font: xft:DejaVu Sans Mono:size=9

XTerm*faceName: DejaVu Sans Mono
XTerm*faceSize: 9


Font size is in points (not pixels).

-