Using xset +fp /usr/share/fonts/terminus I'm able to subsequently start urxvt with the following command and get support for the font that I want (terminus):

urxvt -fn -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*

However, how is this done in .Xresources? How do I specify how the font should be scaled in .Xresources?

This is a Gentoo system.

Simply trying the following don't seem to work:

URxvt*font: xft:terminus:pixelsize=26

As I understand it urxvt uses two font systems, XLFD and Fontconfig. The following link https://wiki.gentoo.org/wiki/Rxvt-unicode#Font attempts to explain some of this. However, even when I verbatim copy the examples they provide, it appears to have no effect at all on what fonts urxvt actually uses.

I believe it uses a default font, which looks very bad on my system.

I've tried to look for debug and verbose flags for urxvt, but its man page doesn't list any. A problem is that urxvt doesn't give any feedback even when starting urxvt from another terminal about what fonts it tries, and where it attempts to look for them.

I've tried fc-list to list available fonts. However, it is not clear to me if this lists fonts that will work with XLFD or Fontconfig. Nevertheless, I've tried just a few at random, again nothing happens.

  • 1
    did you remember to run xrdb -merge ~/.Xresources every time you changed the file? – meuh Sep 15 '16 at 17:11
  • I am running xrdb after updating it. The problem has to be something else. – AttributedTensorField Sep 16 '16 at 12:42
  • If you're still having troubles with this and you're willing to debug a bit more, what happens if you run urxvt -fn xft:terminus:pixelsize=26? The two ways you used to refer to fonts will use different fonts or at least the different font mechanisms. The first one (which you used with -fn) will try to use the bitmap font, the second one tries to load the font through Xft. Two questions would be 1) what's the output of fc-match terminus? 2) did you build urxvt with Xft (USE=xft)? – njsg Aug 31 '17 at 12:24
  • fc-list lists fonts for fontconfig (thus Xft), xfontsel will let you pick X11 bitmap fonts (XLFD). Putting in .Xdefaults (or .Xresources) what you pass as an argument to the -fn option should work in the same way. – njsg Aug 31 '17 at 12:25

As noted in a comment, if you use .Xresources, you should run

xrdb -merge ~/.Xresources

after changing the file. Alternatively, you could edit ~/.Xdefaults (but the people who insist on using xrdb recommend not doing that).

Either way, your resource pattern works-for-me, as well as just this

urxvt -fn 'xft:terminus:pixelsize=20'

(the wildcards do not work for me). Using strace, I can see which files are opened when looking for "Term" or "term"; you might find that useful as a debugging feature:

execve("/usr/bin/urxvt", ["urxvt", "-fn", "xft:terminus:pixelsize=25"], [/* 61 vars */]) = 0
read(7, "#! perl\n\nuse POSIX ();\n\nmy $term"..., 8192) = 1223
access("/etc/fonts/conf.d/50-enable-terminus.conf", R_OK) = 0
stat("/etc/fonts/conf.d/50-enable-terminus.conf", {st_mode=S_IFREG|0644, st_size=254, ...}) = 0
open("/etc/fonts/conf.d/50-enable-terminus.conf", O_RDONLY) = 9
open("/users/tom/.icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/users/tom/.icons/oxy-black/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/oxy-black/cursors/xterm", O_RDONLY) = 7
open("/var/run/utmp", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied)
read(7, "/usr/build/xterm/xterm-325f (101"..., 2048) = 34
chown("/dev/pts/3", 0, 0)               = -1 EPERM (Operation not permitted)

The file with the font information is


which (on my system) contains this:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
        <patelt name="family"><string>terminus</string></patelt>

urxvt doesn't look for a given font. It sets up a call to fontconfig (via the Xft library written by Keith Packard). You can read the source-code for urxvt and see how it does this:

One of the notable (mis)features of Xft with fontconfig is its lack of error reporting. If it fails to find the font you asked for, it will proceed on to offer you its default font. Using strace, you can at least see that the correct font configuration file was used.

  • It doesn't work, even with running xrdb after updates. But "URxvt*font: xft:terminus:pixelsize=26" in .Xresources is the correct syntax? If so, the problem must be something else. – AttributedTensorField Sep 16 '16 at 12:47
  • With strace I can see that it opens stat("/usr/share/fonts/terminus", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0, however I don't see how this information helps. – AttributedTensorField Sep 16 '16 at 17:15

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.