Friday, November 21, 2008

Embed Fonts in HTML document using PHP and Javascript

I wrote a php + js script to replace HTML markup with formatted text in the form of images. The script is called PHPJSFont and it is available at http://code.google.com/p/phpjsfont.

What it does is simple: the Javascript code replaces the text inside HTML tags with an image generated by the PHP script.

Currently it depends on JQuery and PHP 4+ compiled with the GD extension and TTF support.

It should be fairly simple to use, as in:


PJF.replace("h2");
PJF.replace("#topmenu UL > LI");
PJF.replace("h1", { size: 20, color: [255, 0, 0] });

No comments: