8

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.

JeanT
  • 181
  • 1
  • 1
  • 3
  • Possible duplicate: http://unix.stackexchange.com/questions/96973/is-there-a-command-such-as-xwininfo-xdpyinfo-xprop-or-xlsclient-that-will-tel – slm Dec 12 '13 at 00:50
  • 2
    misc-fixed-width6x13. If anyone's interested, I have modified fixed6x13 to have dotted zero and curved 'l' (lowercase ell). Available for Mac, Linux and even Windows: https://github.com/soumyadipdm/Fixed6x13-dotted-zero – Soumyadip DM Dec 30 '15 at 16:13
  • Also, anyone can test on the cli with `printf '\e]710;%s\007' "6x13"`. The Arch Linux URXVT wiki is really good. – dman Jul 16 '20 at 03:05

2 Answers2

6

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.

casey
  • 14,584
  • 5
  • 45
  • 62
3

When I invoke it on my Fedora 19 laptop I noticed this message in a terminal:

rxvt: can't load font "-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1"

Programmatically determining this?

I asked this question some time ago, titled: Is there a command such as xwininfo, xdpyinfo, xprop, or xlsclient that will tell me what font an X client window is using?.

The best you'll be able to do is this:

$ lsof -p $(pgrep rxvt)
COMMAND   PID USER   FD   TYPE             DEVICE  SIZE/OFF    NODE NAME
rxvt    17594 saml  cwd    DIR              253,2     12288 6553601 /home/saml
rxvt    17594 saml  rtd    DIR              253,1      4096       2 /
rxvt    17594 saml  txt    REG              253,1    167360  545755 /usr/bin/rxvt
rxvt    17594 saml  mem    REG              253,1    162472  549496 /usr/lib64/ld-2.17.so
rxvt    17594 saml  mem    REG              253,1   2108632  549497 /usr/lib64/libc-2.17.so
rxvt    17594 saml  mem    REG              253,1     22440  549506 /usr/lib64/libdl-2.17.so
rxvt    17594 saml  mem    REG              253,1     17856  549504 /usr/lib64/libXau.so.6.0.0
rxvt    17594 saml  mem    REG              253,1    125432  549505 /usr/lib64/libxcb.so.1.1.0
rxvt    17594 saml  mem    REG              253,1   1300352  549507 /usr/lib64/libX11.so.6.3.0
rxvt    17594 saml  mem    REG              253,1     43072  549528 /usr/lib64/libXrender.so.1.3.0
rxvt    17594 saml  mem    REG              253,1     26112  549530 /usr/lib64/libXfixes.so.3.1.0
rxvt    17594 saml  mem    REG              253,1     47568  549552 /usr/lib64/libXcursor.so.1.0.2
rxvt    17594 saml  mem    REG              253,1     76688  529186 /usr/lib64/libXpm.so.4.11.0
rxvt    17594 saml  mem    REG              253,1     62368  524974 /usr/lib64/libnss_files-2.17.so
rxvt    17594 saml  mem    REG              253,1 106055264  814955 /usr/lib/locale/locale-archive
rxvt    17594 saml    0r   CHR                1,3       0t0    1028 /dev/null
rxvt    17594 saml    1u   CHR              136,5       0t0       8 /dev/pts/5
rxvt    17594 saml    2u   CHR              136,5       0t0       8 /dev/pts/5
rxvt    17594 saml    3u  unix 0xffff8800acc4ce00       0t0 4920851 socket
rxvt    17594 saml    4u   CHR                5,2       0t0    1298 /dev/ptmx

If there is a font file in use you'll see that file opened when you look at all the files that the rxvt process has in use.

slm
  • 363,520
  • 117
  • 767
  • 871