Unifont as a fallback in rxvt-unicode

rxvt-unicode is a well known terminal emulator for the X window system with support for Unicode. It also supports multiple fonts. This is great because not all fonts have great looking glyphs for all character blocks.

Here is my .Xdefaults config for rxvt-unicode’s fonts settings:

URxvt.font: xft:inconsolata:size=12,\
            -*-unifont-*-*-*-*-*-*-*-*-*-*-*-*

I learned about Inconsolata in a post titled Top 10 Programming Fonts (Hivelogic, 2009). It is a free, very readable fixed width font that I use in my terminal emulator and my website’s <pre>, <code> and <kbd> tags.

GNU Unifont is a bitmap font that covers the entire Unicode’s Basic Multilingual Plane (code points 0x0000 to 0xFFFF). It’s the perfect fallback font because even though it is ugly, otherwise unsupported glyphs are never rendered as a question mark, or worse, as blank space.

The only downside I find is that rxvt-unicode uglyfully scales the second font to fit the first font’s character cells.

Screenshot

Now here is a stitched screenshot of my terminal’s rendering of UTF-8-demo.txt. See how Unifont takes over anywhere Inconsolata lacks a glyph for a code point. You can add other specialised fonts in the .Xdefaults configuration and they will be tried in the specified order.

Notes:

  1. The underlined URL is from the Yankable URLs extension.
  2. There seems to be a bug in rxvt-unicode’s rendering of Ethiopian script (U+1200..U+137F).
  3. I also noticed failure at code points ⎲ U+23B2 SUMMATION TOP and ⎳ U+23B3 SUMMATION BOTTOM in section “Mathematics and sciences”.

Screenshot of rxvt-unicode’s rendering of UTF-8 encoded text with Inconsolata and Unifont
Screenshot of rxvt-unicode’s rendering of UTF-8 encoded text with Inconsolata and Unifont
Screenshot of rxvt-unicode’s rendering of UTF-8 encoded text with Inconsolata and Unifont

Alexandre de Verteuil
Alexandre de Verteuil
Senior Solutions Architect

I teach people how to see the matrix metrics.
Monkeys and sunsets make me happy.

Related