Monday, February 23, 2009

Adding BDF support to my Mobile Font Engine

Having designed my font engine to support proportional-width fonts from the start, I’d been thinking about how to store glyphs:

  1. Should I store one large ‘global image’: an image with all glyphs laid out and a separate table of offsets and widths, particularly delectable samples of which can be found on Ben Fry’s website?
  2. Should I store glyphs in individual files, which would be an implicit description of the same offsets and widths?
It then occurred to me that I was being a silly ass.

Of course there have been standards for this sort of thing before outline-based fonts came to rule the world. Supporting a once-popular standard might make available a related set of utilities, editors and possibly even some nice free fonts. That’s too much to pass up.

So I applied my careful method, as in all things, of indiscriminately picking the first option. Which happened to be the BDF. Calling it the BDF format, being the same as saying the Bitmap Distribution Format format, is a little on the uncouth side.

And here was some unexpected joy: BDF is a 7-bit format! Very nice; nothing niftier than editing a font in TextEdit. To be serious, FontForge seems to support BDF well enough. Or you could just use this fine editor written in Tcl/Tk: Thomas A Fine’s bdfedit.

Here’s a link to the BDF spec, and one to a description of Microsoft’s extension to BDF for anti-aliasing. And of course you can find plenty of BDF fonts (in a legally suspect manner, so don’t do it) with just a google search.

No comments: