A collection of free GDF fonts

A current project (which I might write-up, you never know) requires me to generate some bitmaps with a lot of text, in PHP. I’ve been using the GD library for this (natively a C library, but with a wrapper for PHP) which makes a nice job of generating images – including fixed-width font rendering. Sadly the fonts supplied by default aren’t large enough for what I need.

Fortunately it is also possible to load extra fonts, and the PHP reference pages kindly give a (rather brief, admittedly) description of the GDF file format.

Rather than spend a ridiculous amount of time drawing my own fonts, I dug out the fixed-width bitmap fonts that come with !Zap – my favourite text editor for RISC OS. The !Zap documentation also includes a description of the font file-format, so I knocked-up a quick command-line utility that converts ZapFonts to GDFs. It also generates a PNG of each font as a preview.

All credit and waves of good karma should be directed towards Zap’s kind contributors, without whom this project (and a huge amount of RISC OS coding projects I’ve done in the past) would have been considerably more laborious.

The GDF file format is architecture-dependent, which sucks, but there you are. Little-endian and big-endian versions of each font are provided. For the majority of developers – running their PHP servers on x86 hardware – you’ll want the little-endian version. If you’re unsure of your processor architecture, ask Google.

Have a look here for info on how to load in a font before you render it in PHP.

There’s a few hundred fonts, which makes a table of all the previews and download links a bit cumbersome for a super-svelte blog like this one. So I’ve stored all the fonts in my old-fashioned, lovingly hand crafted HTML website. Have a look here to see them. I hope that this┬áselection of larger GDFs will prove useful for others.

Though, now I’m thinking it would have made more sense just to provide a single zip file for download … Ah, well.

I have another half-baked program that generates GDFs from Truetypes (obviously, fixed-width ones look best). If I ever need any larger or unusual fonts, I’ll add them to the collection.