Location: PHPKode > projects > PHP Cad and Drawing Program > functions/tttexttrans.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 tttexttrans($image,$fontsize,$angle,$tclr,$ttfont,$text,$pct,$scale,$x,$y) {
    $red  = hexdec(substr($tclr,0,2));
    $grn  = hexdec(substr($tclr,2,2));
    $blu  = hexdec(substr($tclr,4,2));
    $clr = ImageColorAllocate($image,$red,$grn,$blu);
  $ttfont=getcwd() . "/ttf/$ttfont";
  $fontsize=$fontsize*$scale/10;
  $x=$x*$scale;
  $y=$y*$scale;
  $im_w = imagesx($image);
  $im_h = imagesy($image);
  $new = imagecreate($im_w,$im_h);
  imagesetpixel($image,$im_w-1,0,$clr);
  $index = imagecolorat($image,$im_w-1,0);
  $rgb = imagecolorsforindex($image,$index);
  $r = $rgb["red"];
  $g = $rgb["green"];
  $b = $rgb["blue"];
  $color = imagecolorallocate($new,$r,$g,$b);
  $copy = imagecopy($new,$image,0,0,0,0,$im_w,$im_h);
  $text = imagettftext($new,$fontsize,$angle,$x,$y,$color,$ttfont,$text);
  $merge = imagecopymerge($image,$new,0,0,0,0,$im_w,$im_h,$pct);
  imagedestroy($new);
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCC
function tttexttrans($image,$fontsize,$angle,$tclr,$ttfont,$text,$pct,$scale,$x,$y) {}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "no";
$dirlist= array("NA");
$lenlist= array("NA");
$txtitem="AAAAAA";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program