--On 26. september 2002 17:21 +0100 Kjell <[EMAIL PROTECTED]> wrote:
> I am  calling the GD2 package from PHP to generate graphics to be
> displayed  on web pages. Everything I have tried are working fine, with
> one exception:  When I make a call like
> $size = ImageTTFBbox (10, 0, "fonts/arial.ttf" , "hello");
> I get an arror message like
> Warning: Could not find/open font in /home/www/htdocs/t3.php on line 21
> Is it required to compile GD2 with certain options to be able to use True
> Type  Fonts?
> Could it be something wrong with my font files?

I seem to recall that the fonts should reside in 
"/usr/share/fonts/truetype/" and should be referred to as just the name of 
the font-file without the ".ttf" on the end.

Here is an example. I have several *.ttf files in /usr/share/fonts/truetype 
(which is just a symlink to /usr/X11R6/lib/X11/fonts/webfonts which was 
populated by installing the x11-fonts/webfonts port):

eivind@trisha:~ > ls -la /usr/share/fonts/truetype/ | grep courbi
-r--r--r--   1 root  wheel  234788 Sep 29 20:16 courbi.ttf
eivind@trisha:~ >

Here is an example script (taken from the "Programming PHP" O'Reilly-book):

eivind@trisha:~ > cat ~/public_html/fonttest.php
<?php

$im = ImageCreate(350, 70);
$white = ImageColorAllocate($im, 0xFF,0xFF,0xFF);
$black = ImageColorAllocate($im, 0x00,0x00,0x00);
ImageTTFText($im, 20, 0, 10, 40, $black, 'courbi', 'The Courier TTF font');
header('Content-Type: image/png');
ImagePNG($im);
?>

eivind@trisha:~ >

As you can see it references the font as "courbi" even though the fontfile 
is "courbi.ttf".

Someone mentioned absolute paths, but absolute paths are only required if 
you're using GD1 (and you said you were using GD2) or if your fonts are not 
found in /usr/share/fonts/truetype/

I hope this helped.

-- 
Eivind Olsen
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to