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 a convenience alias for a bitmap font that comes with X.org. It doesn't mean anything specific, there's simply a "fonts.alias" table that translates it to an XLFD:

    ! $Xorg: fonts.alias,v 1.3 2000/08/21 16:42:31 coskrey Exp $
    fixed        -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
    variable     -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1
    5x7          -misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-1
    8x16         -sony-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-1
    9x15         -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1
    9x15bold     -misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1
    10x20        -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
  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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.