View Single Post

  #2 (permalink)  
Old 07-07-2003
Zac Hester
 
Posts: n/a
Default Re: True Type Fonts (FreeType) - GD - PHP 4.3.2

Paul,

Thanks for the idea. I tried what you said and used the
imagecreatetruecolor() function and it does the exact same thing. It
creates a blank, white picture.

Thank you for your time,
Zac


"Paul Liversidge" <paul_liversidge@hotmail.com> wrote in message
news:bf26a194.0307032149.379bccf6@posting.google.c om...
> "Zac Hester" <news@planetzac.net> wrote in message

news:<3f04dfe3$1@news.enetis.net>...
> > Hello,
> >
> > I'm having a problem using the TTF support in GD. I just installed the
> > latest release of PHP (4.3.2) and the latest version of FreeType

(1.3.1).
> > Everything compiled fine and a call to phpinfo() says it's all installed
> > exactly as it should be:
> >
> > GD Support enabled
> > GD Version bundled (2.0.12 compatible)
> > FreeType Support enabled
> > FreeType Linkage with TTF library
> > GIF Read Support enabled
> > JPG Support enabled
> > PNG Support enabled
> > WBMP Support enabled
> > XBM Support enabled
> >
> > I copied a few fonts off of my Windows machine to my web site. Now, I

use
> > the universal demonstration script found on every site showing how to

use
> > TTF support:
> >
> > <?php
> > header("Content-type: image/jpeg");
> > $im = imagecreate(400,30);
> > $white = imagecolorallocate($im, 255,255,255);
> > $black = imagecolorallocate($im, 0,0,0);
> > imagettftext($im, 20, 0, 10, 20, $black,
> > "/usr/loca/apache/htdocs/systems/fonts/arial.ttf",
> > "Testing... Omega: &amp;#937;");
> > imagejpeg($im);
> > imagedestroy($im);
> > ?>

>
> I actually think it's a problem with the GD but I'm only guessing
> having had similar problems with color allocation.
>
> As you've got GD v2 I'd replace the imagecreate with
> imagecreatetruecolor
>
> If that doesn't work, keep the imagecreatetruecolor, GD v2's preferred
> way of creating images and add this line before the imagettftext.
>
> imagefilledrectangle ($im, 0, 0, 399, 29, $white);
>
> imagecreate used to set the background to the first allocated colour,
> white in this example and it seems to work correctly given your
> results. However, in a recent application this didn't work and I had
> to paint the background. This little addition is grasping at straws
> but I think the first one may solve it. :)



Reply With Quote