note 16167 deleted from function.imagettftext by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 22:46:02 +0000 |
| Subject: | note 16167 deleted from function.imagettftext by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23050@lists.php.net to get a copy of this message | ||
The font path issue is in no way related to PHP as the gd library itself loads the font and not PHP.
As observed, absolute paths do work when the font file is in a custom path.
GD has a built-in default directory where to search for font files. On my recent debian system this
is /usr/share/fonts/truetype .
So, if you supply a font name not starting with a '/' (and, sadly this is also true for
windows) it is searched in the default path PLUS(!) the extension 'ttf' is added.
myfont -> /usr/share/fonts/truetype/myfont.ttf
/myfont -> /myfont
./myfont.ttf /usr/share/fonts/truetype/./myfont.ttf.ttf
However, you can supply a custom default search path with the environment variable GDFONTPATH:
<?
putenv('GDFONTPATH=/home/user/myfonts');
ImageTTFFonts('myfont');
?>
Will be expanded to
/home/user/myfonts/myfont.ttf
HTH to clean up the fuzz (in now way I think this is a good behaviour ;)
- Markus