He aqui la clase:
Código PHP:
   <?php
header('Content-type: image/png');
class GenerateTextFromFont{
    //Generate the text with font selected
    function createText($width,$height,$size,$color,$background,$font,$text){
        // Create the image
        $img = imagecreatetruecolor($width, $height);
        //Color text and color of background
        $color=imagecolorallocate($img, $color[0], $color[1], $color[2]);
        $background=imagecolorallocate($img, $background[0], $background[1], $background[2]);
        imagefilledrectangle($img, 0, 0, $width, $height, $background);
        //Set properties
        imagettftext($img, $size, 0, 1, $size, $color, $font, $text);
        //Results
        imagepng($img);
        imagedestroy($img);
    }
}
?>    Código PHP:
   <?php
include('GenerateText.php');
//Instance of GenerateText
$objGenerateText=new GenerateTextFromFont();
//$objGenerateText->createText(70, 15, 10, array(10,100,100),array(255,255,100), 'Fonts/FIRESTARTER.TTF', "Tester...");
$objGenerateText->createText(70, 15, 15, array(10,100,100),array(255,255,255), 'Fonts/gothica_class_2.ttf', "Tester...");
?>    Código PHP:
  
<html>
    <head>
        <title>Uso de fuentes</title>
    </head>
    <body>
    <table>
        <tr><td>
    <?php
     include('GenerateText.php');
     //Instance of GenerateText
     $objGenerateText=new GenerateTextFromFont();
     $objGenerateText->createText(70, 15, 10, array(10,100,100),array(255,255,100), 'Fonts/FIRESTARTER.TTF', "Tester...");
    ?>
    </td></tr>
    </table>
    </body>
</html>    
 


