GD::Font->load()

LTjake on 2004-02-19T13:11:03

I recently emailed Lincoln asking about PHP's imageloadfont(). Basically, I was wondering why Perl's GD didn't have something similar. The structure of the fonts loaded by said function are pretty simple:

byte 00-03 int number of characters in the font 
byte 04-07 int value of first character in the font (often 32 for space)  
byte 08-11 int pixel width of each character 
byte 12-15 int pixel height of each character 
byte 16-   char array with character data, one byte per pixel in each character, for a
           total of (nchars*width*height) bytes.

This is essentially the struct used to for all internal GD Fonts (e.g. GD::Font->Small).

Within a couple days Lincoln had sent me a new version of GD with this support which worked flawlessly. Awesome! He also plans to write support for X11 bitmap fonts -- Bonus.