URxvt Font Rendering – Fixing Too Much Space Between Characters

fontsurxvtxft

Starting earlier today I am getting font rendering issues with rxvt-unicode. Specifically with many fonts I get an abundance of extra space between characters. In other fonts rxvt refuses to change sizes.

Here is an example of the spacing issue between urxvt and xterm.

The fonts resources:

URxvt*font:     xft:Terminus:medium:size=10
xterm*faceName: xft:Terminus:medium:size=10

And the renderings

  • urxvt bad fonts
  • xterm good fonts

I have tried all permutations of hinting and antialiasing. Changing size or pixelsize does resize the font in urxvt but this also increases the extra spacing.

Does anyone have ideas I can try to fix this?

Best Answer

Urxvt has an option for basic kerning: letterSpace. See man urxvt:

-letsp number
Compile frills: Amount to adjust the computed character width by to control overall letter spacing. Negative values will tighten up the letter spacing, positive values will space letters out more. Useful to work around odd font metrics; resource letterSpace.

So you can adjust the spacing by adding a line to your ~/.Xresources, like so:

URxvt.letterSpace: -1

Note: it is difficult to tell from your first screenshot, but it looks like Urxvt is falling back to the default font as it can't find or load Terminus, hence the wide spacing. Terminus is a bitmap font (which is likely disabled by default), so you should use xfontsel to copy the correct font string into your definition.

See the Arch Wiki page on X Logical Font Description for a detailed description of how this system works.

Related Question