The default font used in rxvt

rxvturxvt

I have installed urxvt and I like the default font being used (white font in attached screenshot) but I can't figure out what it is.

The font is not defined in Xresources or Xdefaults.enter image description here

I have also read that it uses one of the font in fc-list but I don't know which one is being used exactly.

Best Answer

If no fonts are specified in .Xdefaults, .xresources or on the command line, the default single-byte font rxvt uses is 7x14.

From the file src/defaultfont.h in the rxvt source:

82 #define NFONT_LIST \
83   "7x14", "6x10", "6x13", "8x13", "8x16", "10x20", "12x24"

These fonts are loaded into the default rxvt font set in their respective positions when nothing has been specified for that position. Note that if you use a multi-byte encoding, there is a different default.

In response to the comment below, I cannot say for sure whether that is 6x13 or not, all I can point to is this logic in defaultfont.c

300  if (encoding >= ENC_ISO8859_1 && encoding <= ENC_ISO8859_LAST) {
301    /* fallback for ISO-8859-* encodings */
302    k = encoding - ENC_ISO8859_1 + 1;
303    MIN_IT(k, 99999);
304  } else
305    /* fallback for "C", "POSIX", and invalid locales */
306    k = 0;
 :
308   for (j = 0; j < MAX_NFONTS; j++) {
309     if (rs[Rs_font + j] == NULL) {
310       if (k == 0)
311       rs[Rs_font + j] = def_fontName[j];
312     else {
313       /* couple of wasted bytes each but lots of future expansion */
314       rs[Rs_font + j] = rxvt_malloc(STRLEN(defaultfont_8859[j]) + 4);
315       sprintf((char *)rs[Rs_font + j], defaultfont_8859[j], k);
316     }
317   }

If the locale is C the Rs_font[0] is 7x14 and Rs_font[2] is 6x13. When and where [0] vs [2] are used to render text is beyond my motivation to search through this unfamiliar code.

If the encoding is not C/POSIX, the 8859 fonts loaded by the above code are:

#define NFONT_LIST_ISO8859X \
"-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-%d",       /*xf*/ \
"-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso8859-%d",       /*xf*/ \
"-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-%d",/*xf*/ \
"-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-%d",       /*xf*/ \
"-misc-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-%d",     /*xf*/ \
"-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-%d",      /*xf*/ \
"-misc-fixed-medium-r-normal--24-170-100-100-c-120-iso8859-%d"     /*xf*/

And if multi-byte encodings are in use, a whole different encoding specific set of fonts are used for the default.

Related Question