Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/functions/tttext.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//
//    Use by hand. Fonts relative to scale 10.
//    Puts truetype font on screen.
//
//    $dir = direction
//    $color = color
//    $ttfont = truetype font name, example 'arial.ttf'
//    $ttext =  text to print, example 'Hello World'
//    $fontsize = relative to scale = 10.
//
function tttext($image,$dir,$acolor,$ttfont,$ttext,$fontsize,$scale,$x,$y)
{
    $red  = hexdec(substr($acolor,0,2));
    $grn  = hexdec(substr($acolor,2,2));
    $blu  = hexdec(substr($acolor,4,2));
    $zz = ImageColorAllocate($image,$red,$grn,$blu);

    $ttfont=getcwd() . "/ttf/$ttfont";
    $fontsize=$fontsize*$scale/10;
Imagettftext($image,$fontsize,$dir,$x*$scale+1,$y*$scale+1,$zz,$ttfont,$ttext);
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCC
function tttext($image,$dir,$acolor,$ttfont,$ttext,$fontsize,$scale,$x,$y)
{
global $zz;
$size=$fontsize/7.5;
$a='ttf "./ttf/' . $ttfont . '" "' . $ttext . '" 0.2, .05*x';
$ot = "
text {
   $a
   pigment { BrightGold }
   finish { reflection .50 specular 1 }
   // normal { dents .75  scale .3 }
   rotate <270, $dir, 0>
   scale <$size,1,$size>
   translate <$x,0.1,$y>
   }\n";
fwrite($zz,$ot);
}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "no";
$dirlist= array("NA");
$lenlist= array("NA");
$txtitem="AAAAAA";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program