views:

27

answers:

1

Are there existing libraries for generating .ttf via image(s) using PHP (say, a series of images)? There are several references about creating gdf from images, but I've not yet found examples of ttf-font creation via PHP.

N.B. There are also several online resources that let you upload an image (write a letter in each box on an image template) to be instantly converted to a TTF. http://www.yourfonts.com is one of them

+5  A: 

To my knowledge, there is no such tool.

Creating a TrueType font is a hugely difficult enterprise. A font consists of a lot of very complex information (see the "technical notes" in the Wikipedia article to get a tiny impression). It won't do to just paste a series of images together.

Depending on what you want to do, I suppose you could work around this by building a faux "bitmap font", one image file containing one character, and glue the correct images together to form a sentence. The results will probably be less than perfect, though, because there will be no Kerning.

Pekka
Sure, but you can use line-detection on an image and do something very basic.
Rup
@Rup yup, but for that you have to vectorize the outlines of each image, an write them into a TTF font. Both not impossible tasks of course, but PHP is not the perfect language for this - especially the first part
Pekka
what would be a better language (that runs well on a LAMP server)?
ina
@ina stuff like this is often done in a compiled language like C or C++. There may be ready-made tools for these tasks - [potrace](http://potrace.sourceforge.net/) may help with the vectorization for example.
Pekka
Pekka