The "oilpencil" font

There's a more recent and readable version of this font called pencilitalic.

This is the first TrueType font I ever created; it covers ASCII and is based on my handwriting. Much to my surprise, it came out reasonably legible, although it's most suitable for use as a "funky" font for titles and the like.

I've written a page about the process of creating it, and you can download the TrueType font or download the Fontforge font. I've dedicated it to the public domain, so you're legally free to redistribute it, include it in your software, modify it, sell it, whatever you want.

Additionally, this page is located in a darcs repository for the font, so you can download the font and all these web pages for your own modification and patch exchange with the following command:

darcs get http://canonical.org/~kragen/oilpencil

Demonstration text

It's traditional to show off a font with pangrams. These are reduced-size screenshots from Fontforge's metrics view, because there doesn't seem to be any other software on my system that respects TrueType kerning information.

Here are the same pangrams in gnome-terminal, which does a remarkably good job of forcing this font into service as a monospace font.

I was hoping to have a font that would be reasonable for programming in as well — which means all the ASCII characters have to be easy to distinguish (especially including the troublesome "iIl1" and "O0o" families, but also "{([" and "])}" and the "`" and "'" characters). It's also nice to have "*" and "~" be relatively large for their use as infix operators, rather than tiny. An unforeseen problem was that the "i" looks too much like a ";", even though it doesn't look much like the semicolon in the oilpencil font. (The example text here is part of a Burrows-Wheeler program entered by Thomas B√§tzler in a Perl Golf competition in 2002.)

Unfortunately, the other thing a programming font needs is readability at small sizes, because computer screens are still small yet made out of big pixels, and being able to see a lot of text at one time helps immensely. Here, oilpencil currently fails badly. In part, this problem is common to all non-bitmap fonts and could therefore perhaps be fixed by including low-res raster versions of the fonts in the file, but part of it is particular to oilpencil. I think the version at right, at 13 pixels per line, is roughly the smallest pixel size that is usable on my LCD.

With the GIMP, I removed all the extraneous whitespace between the five lines, resulting in this 49-pixel-high version. The extra three pixels of leading are due to me not knowing how to use Fontforge when I started this process. If I can solve that problem, I should be able to use the font for programming at this 6x10 size.

This is the same size as Proggy Tiny, and it's not immediately obvious that it's far less readable. The smallest fonts I normally use for programming these days are 7x13, although I grew up reading my programs in 5x8 and 5x9 characters, 56% smaller. Here's the same Perl text in Proggy Tiny.

Proportional fonts generally use substantially less horizontal screen space, but for a variety of cultural reasons, they are not acceptable for programming.

Via xfstt, I also got it working with the old X11 font machinery that xterm normally uses, and here you can see xterm with a slightly larger version of this font. Unfortunately, this version is not antialiased, not LCD-enhanced, and I haven't even hinted it much, so it's pretty hard to read.

Then Aristotle Pagaltzis told me xterm could use Xft, too, and it looks lots better that way. This version is LCD-optimized, so it may be hard to read on a CRT. Thanks, Aristotle!

If you're using a CRT, or if the above samples don't look very clear to you, here's a close-up photo of how it looks on my LCD. Notice how the stem of the "n" is less than a pixel wide, so even though it's contained in a 5x6-pixel area here, it can show some fine details of slant and stroke weight.

Miscellaneous

The lower case is mostly a relatively traditional non-oblique italic font, but it's fairly sloppy.

At present, the font still has a lot of problems, some of which you can even see in the screenshot, but it's relatively legible at small sizes. I might get around to improving it, or I might not.

One of the biggest problems is that the cap-height is much less than the full line-height, effectively reducing the font-size and forcing lots of extra leading between lines. I'm not sure how to fix this.

The name comes from the process I used to create most of the glyphs: draw them in pencil, then "oilify" the (thresholded) pencil marks in the GIMP. (I sure do miss xv.)

Installing a TrueType font on Linux

I'm using an old-ish version of Ubuntu that uses fontconfig 2.2.3-4ubuntu7. If you're using Linux and fontconfig, this will probably work for you too:

  1. Copy the .ttf file into /usr/share/fonts/kragen (or some other directory under /usr/share/fonts)
  2. sudo fc-cache -f

It turns out xterm can also use the Freetype Xft TrueType font support in current X11 — just use xterm -fa oilpencil-13 rather than the -fn option.

However, the above only makes it visible to applications that use fontconfig, such as the GIMP, KDE, GNOME, and Mozilla; it's slightly more work to make it show up in applications like xfontsel which use the old X11 font machinery:

  1. Install xfstt, e.g. sudo apt-get install xfstt.
  2. Copy the .ttf file into the directory xfstt looks in, usually /usr/share/fonts/truetype.
  3. Restart xfstt if necessary (sudo /etc/init.d/xfstt restart).
  4. You have to specify the point-size explicitly, since xfstt won't give you a fixed list of point sizes to choose from — the one that shows up in xfontsel is reported as size 0, although it does have some actual size. So you can use e.g. xterm -fn '-*-oilpencil-*-*-*-*-16-*-*-*-*-*-*-*' to use it in xterm at a 16-pixel size. I still don't know how to get Emacs to use it.

As noted above, the resulting font won't be LCD-optimized or antialiased, since the old X11 font machinery doesn't support that.

Once I bothered to spend ten minutes reading the font setup documentation, I learned that recent X servers also support TrueType, in roughly the same fashion as xfstt — although the XLFD font names are a little different. So you don't even need xfstt any more. The steps are:

  1. Copy the .ttf file into, say, /usr/share/fonts/truetype.
  2. sudo mkfontscale /usr/share/fonts/truetype
  3. sudo mkfontdir /usr/share/fonts/truetype
  4. xset fp+ /usr/share/fonts/truetype
  5. Test it: xterm -fn -misc-oilpencil-medium-r-normal--20-0-0-0-p-0-iso10646-1
Kragen Sitaker <kragen@canonical.org>