This free PHP code creates GD fonts for use with PHP’s ImageString function. It takes a PNG as input and creates a GD compatible font from it. The online demo includes an example PNG and detailed usage instructions.
Essentially, you supply an image like this:
And this code will create a GD compatible font from it. Cool eh?
If you’re looking to re-create existing fonts, try the windows font to GD Font convertor by philiplb.de
I think my script is more useful for creating your own custom GD fonts, or if you want to modify an existing font (or for learning exactly how GD fonts are constructed).
#1 by Fiestoforo on May 27, 2010 - 6:45 am
Thanks for this! Will give it a try!
#2 by yos on November 11, 2010 - 12:34 am
did anyone get this to work?
#3 by Evan Knight on December 2, 2010 - 12:12 pm
Yes, it actually works. Created a PNG file in photoshop and uploaded worked like a charm.
#4 by Walter Tross on April 8, 2011 - 6:06 am
It works only if you input THE starting character, instead of its code.
So, if you want to start from the space character, you have to input one space character instead of 32.
If you want to use the source code and don’t like this, simply remove the ord() function from the assignment to $startchar.
#5 by Cary on September 15, 2011 - 8:10 am
Hi there! This really is my 1st comment in this article and so i i would like to present a simple shout out and let you know I absolutely love reading through your blog articles. Do you suggest some other blogs