ID: 12064
User updated by: [EMAIL PROTECTED]
Old Summary: Truetype functions can't locate fonts
Status: Analyzed
Bug Type: GD related
Operating System: Windows 2000 SP1
PHP Version: 4.0.6
New Comment:


  I did some reading through the GD docs; it seems that GD uses an environment 
variable called GDFONTPATH to locate its fonts when no path is specified (this seems 
to imply that the proper extension would also be appended). However, setting this 
properly did not work. The documentation also says that a full path will be accepted 
(with .ttf ending) if specified as a parameter.

  Seems like a problem with the way PHP is passing the string, perhaps. I would play 
with the source, but I don't have a compiler for this environment right now; it seems 
that people are not having this problem on Unices, so I won't bother looking there.

Any clue?


Previous Comments:

[2001-07-12 14:36:33] [EMAIL PROTECTED]

No idea about the Windows version, but on UNIX the new GD2 library is hardcoded to 
look for TTF fonts in /usr/share/fonts/truetype.  Also, it automatically adds the .ttf 
extension itself so in your code you should not put the .ttf extension on your font.


[2001-07-11 15:03:28] [EMAIL PROTECTED]

The GD TrueType functions can't find fonts; relative paths and absolute paths both do 
not work.

Example (font is in the local directory, and . is part of my php.ini include_path)
$image = ImageCreateTrueColor(200,200);
ImageTTFText($image, 20, 0, 2, 15, $red, "d:/path/to/font.ttf", "Some text.");
header("Content-type: image/jpeg");
// alternatively, ImageTTFText($image, 20, 0, 2, 15, $red, "font.ttf", "Some text."); 
header("Content-type: image/jpeg");
ImageJPEG($image, '', 100);
(written off the top of my head, it's in a larger script, but test scripts I wrote and 
unfortunately deleted don't work either)

PHP reports: Warning: Could not find/open font in d:\path\to\fonttest.php on line 3

This is from the binary Win32 distribution of PHP 4.0.6 on


Edit this bug report at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to