GD Fonts (*.gdf fles)

antiaverage's picture

I am new at font creation, as will be apparent by this post, and was wondering how to go about making bitmap fonts. Allow me to give you a bit of context... I am working with php dynamic imaging, specifically the GD Library. I want to create custom bitmap fonts in order to load with the imageloadfont() function. It may help you answer my question if you take a look at the following page:

http://www.widgnet.com/gdf_fonts/

For a small library of these fonts to play with or at least take a look at in order to help answer my questiong, please take a look at the following page:

http://www.widgnet.com/gdf_fonts/fonts.html

Apparently the creator of this site was able to convert TTF fonts into GDF fonts fairly simply, but he does not explain how, or perhaps I am overlooking a key part of the site.

Essentially, I want to be able to create a small bitmap (maybe 8 by 13 px or something similar, that's not the important part...) for each letter/symbol and compile these bitmaps into a font file. This font file then has the following information:

byte 0-3 (int) number of characters in the font
byte 4-7 (int) value of first character in the font (often 32 for space)
byte 8-11 (int) pixel width of each character
byte 12-15 (int) pixel height of each character
byte 16-EOF (char) array with character data, one byte per pixel in each character, for a total of (nchars*width*height) bytes.

And while I may understand what this information is saying, I'm not sure how to go about using it. Any and all help is appreciated. Thank you =)

-Trevor

antiaverage's picture

Hmm... I found a PHP font converter which converts a *.png file into a *.gdf file, but is this the only way to go about creating a *.gdf file?

Mark Simonson's picture

Wow, that's interesting. One of the bitmap fonts that guy did is based on my Anonymous™ TrueType font. I can't decide whether to be annoyed or honored. Hmm.

user24's picture

yo, I'm the puremango dude; if you're talking about the example font on the png2gdf app, I can change the font or link to you if you want? sorry if you're annoyed; I know how it feels when your work gets passed off as someone else's and I promise that wasn't the intention here.

user24's picture

and to antiaverage, if you know PHP, the font convertor tool goes through the process step by step, alternatively if you're looking for other ways of creating GD fonts, check out philiplb.de's TTF2GDF tool

Mark Simonson's picture

user24--It's okay, but it would be nice if you could credit the source somehow. Anonymous™ is a free font, but not free-as-in-free-beer.

user24's picture

mark; actually on further inspection, the font I used was Arial - I couldn't remember because it's been a while since I wrote the app.

When you said One of the bitmap fonts that guy did is based on my Anonymous™ TrueType font, I thought you meant me, but I think you were actually refering to the widgnet URL, not the example PNG on my site.

Ah well, if I had used your font, you can be assured there would now be a link to you. ;-)

Mark Simonson's picture

I was referring to this:

http://www.widgnet.com/gdf_fonts/preview/anonymous.png

Sorry for the confusion.

pliskin12's picture

I've been struggling with GDF fonts lately, too. Apparently, the fonts are architecture-dependent. I need to use them on a Sun Sparc machine, so the tools mentioned earlier in this thread don't really work for me. Is there anywhere I can get step-by-step info on how to create these fonts? Or, is there a tool out there that works for Sparc machines?

eomine's picture

This thread is old, but anyway.
Instead of using GDFs, one can also use TrueType fonts with the imagettftext function in PHP+GD.

-- omine.net

Syndicate content Syndicate content