Typeface Trickery with X11
Last updated March 18th 1999


The X11 window system was never intended to do much with fonts unfortunately. There is a distinct lack of tools and features found in most window systems today, such as Windows and MacOS. The most basic of these and the one that bothers me the most is the lack of basic, on-screen anti-aliasing of fonts! To be fair however, and through my own testing - I have found that X can handle so many more fonts concurrently loaded than Windows by a long shot. I had somwhere around 2,300 fonts installed and usable at one point. X itself remained unphased by this, however application startup time suffered on programs like the GIMP or xfontsel, which uses fonts a good deal and catalogs them. In and of itself, the time added to the startup wasn't that great, considering the sheer number of fonts that I now had available.

These days however, are bringing about a greater number of available tools. You can now install normal Type 1 fonts and even use Windows TrueType fonts using a font renderer, which I'll detail below (and which conincidentally inspired this article).

Stock X Tools

Default tools that come with nearly every X distribution include:

Fonts may appear somewhat crazy looking under X due to the long string often associated with a font. One example might be:


...which is the font you'll see represented in the below screengrab of xfontsel. With this string, it's possible to represent all parameters of a font - what foundry, family, size, weight and other attributes are just an example. In most programs however, you'll see just then family itself (like "Helvetica"). The asterisks merely denote a "default" setting.

Stock tools provide some basic font control such as selecting a font from those you have installed and building the appropriate font string for it with xfontsel. A much more powerful and beneficial utility called xfs allows you to enable a "font server" for your network (where it's usually used - standalone machines won't benefit). Why is it powerful? Let's say you have a network of ten machines for a group of artists or writers and you have a bunch of fonts that everyone uses. Rather than install these fonts on each and every machine, you set up a font server that has all the fonts you'll expect to use - the other machines merely map to the machine running the font server and immediately gain access to those fonts installed there. This saves space on each machine and makes a central repository for fonts which can be installed or updated at will (which then affects all users of the font server). A pretty slick idea. Lastly, there's xfd which will show you all the characters that a given font contains - useful if you want to know how to represent a foreign or high-ASCII character or to see how complete a certain font is.

Types of Fonts

Using fonts with X is rather simple. They usually reside under the /usr/X11R6/lib/X11/fonts/ directory with Linux (Red Hat at least) and /usr/lib/X11/fonts with Irix. They are bitmapped fonts and as such, scale very poorly. By swapping the order of the 75dpi and 100dpi fonts in your font path, depending on your screen resolution - may result in nicer looking on-screen fonts. Try it and see! I would recommend this on resolutions of 1280x1024 or higher on the appropriate monitors. Note that this will affect your entire X desktop - menubars, window titles, text within editors and so on all change to a different resolution.

The appeal of Type 1 and TrueType fonts is that they are vector based and scale much better than bitmapped fonts. Not only that, but the sheer number of these types of fonts availabe on both the Internet and cheap CDs like Key Fonts makes them economical as well.

What's the big deal with fonts, anyway? A great deal! Text is used to convey information to your readers. No amount of fancy graphics or pictures can make up for explaining something to someone through text (if done well anyway). Text is one of the most important mediums of communication. How you represent your text through fonts can say as much as what you actually write. How? Let's say you're inviting someone to a classy party. Most often, you'll see this rendered with a flowing script-like font - it conveys class and elegance. If you want to grab a persons attention quickly, you would use a large, clean and heavy font. The font chosen is very important to how your message will be taken - take a look through a newspaper or magazine and pay special attention to the fonts used throughout each ad. Even comics - handwritten style fonts are used mostly because it's part of the overrall artwork, but also because comics are light-hearted and informal. Inverse to this are formal business communications, often represented using serifed fonts.

What the hell is a serif? If you look at a "serif" font (like Times), you'll notice that the letters such as "A, I, T, H" and so on have little bars at the ends of lines for closure. A "sans-serif" font lacks these (like Helvetica). Reading text has a lot to do with pattern recognition. That is to say, you don't mentally note each individual character, but recognize a word by it's form. Serifs improve this recognition and often make the text appear more formal. In the image above, you'll see Helvetica, Times and a blow up of a serif from the Times character, respectively. Personally, I prefer san-serif fonts because they're "lighter" and cleaner, to me.

I would like to point out one common mistake that people make time and time again. That's mixing a bunch of fonts on one page. Please don't. Not only is it against most design rules, it's annoying. You should try to keep the number of fonts used on one page to three or less. This does not include font treatments such as bold or italic, but different typeface families. More than this and it becomes a tedious, poor design.

Using TrueType Fonts

TrueType fonts are plentiful and cheap. The quality ranges from utter garbage to some truly nice ones. You can download them from the Internet or as mentioned above, get cheap CDs crammed with 2,500 of them for around $12.99 US. I've done both and have managed to amass a rather insane number of them. Not that you can install five zillion fonts and expect to be able to access them all - there are limits to what X can do and not all X servers are the same. You are advised to read the xfstt FAQ which goes into some detail on these limitations or a technical X document describing the X protocol. It lies in the 256Kb limit to replies.

With a program called xfstt or X11 Font Server for TrueType fonts is one available TrueType rasterizer available, and one that I use on both my Linux and SGI boxes with great success. It's rediculously simple to compile, install and use and I had no problems with either platform.

You should read the documentation that comes with it, but in a nutshell you would compile and install with "make ; make install" as root. Then, go to the directory in which you keep your TrueType fonts (/usr/X11R6/lib/X11/fonts/ttfonts on Linux recommended) and run xfstt with the "--sync" flag. This initializes the fonts and tells xfstt about them. You only have to do this the first time, or with font changes. After that, just run it by itself in the background with "xfstt &". Once you've done this, add the TrueType fonts to your font path with the command "xset fp+ unix/:7100" at the command line or in your appropriate X server's configuration file. That's it! Fire up the GIMP and try out the text tool. You'll notice quite a few new fonts! The beauty is that they anti-alias beautifully with the GIMP. They even show up in the stock tools such as xfontsel. A very simple, sano solution! Don't forget that if you wish this to happen with each system boot, you'd be well advised to create the appropriate entries to your systems startup files (/etc/rc.d/rc.local isn't a bad place for Linux). Notice the small size of the sliding handle in the font selection area of the screengrab to the left - that's quite a bunch of fonts!

Using Type 1 Fonts

Type 1, or Postscript fonts are high quality fonts most often found on Macintosh computers and increasingly, Windows machines as well. They are ideal for printed media and are very commonly found in print shops. Type 1 libraries are also available as readily as TrueType fonts, but special libraries on CD can be very expensive, such as Adobe's. These are of course, super high-quality and professional in nature. If you're in the advertising business and do jobs for screen and/or print, chances are that you'll need or want this collection. Foundries that make these fonts include Adobe, Bitstream, Agfa and Linotype Hell for starters. Luckily there are quite a few nice tools for X in dealing with these types of fonts.

I'll be adding this section shortly...

All images are (C) 1994-2005 by Michael Holve