php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6960 Cannot find/load truetype font
Submitted: 2000-09-30 10:23 UTC Modified: 2001-07-27 13:06 UTC
From: danradigan at yahoo dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.2 OS: Win 2000
Private report: No CVE-ID: None
 [2000-09-30 10:23 UTC] danradigan at yahoo dot com
I ran the PHP Easy installer for windows and get this error on my win2k system.  The behavior exists on NT4 as well.  It seems to run OK on Linux though.

PHP OUTPUT---
<br>
<b>Warning</b>:  Could not find/open font in <b>c:\inetpub\wwwroot\freeways\test\gd2.php3</b> on line <b>5</b><br>
<br>
<b>Warning</b>:  Could not find/open font in <b>c:\inetpub\wwwroot\freeways\test\gd2.php3</b> on line <b>15</b><br>
<br>
<b>Warning</b>:  Could not find/open font in <b>c:\inetpub\wwwroot\freeways\test\gd2.php3</b> on line <b>16</b><br>
?PNG


IHDR?????_	PLTE,m????p?>IDATx???1? ?Om
 >
???QJ?IEND?B`?<br>
<b>Warning</b>:  Unknown list entry type in request shutdown (15605704) in <b>c:\inetpub\wwwroot\freeways\test\gd2.php3</b> on line <b>18</b><br>

MY CODE-----------

<?
  
   Header( "Content-type: image/png");
    $s=40;
    $size = imagettfbbox($s,0, "Adventure.ttf",$text);
    $dx = abs($size[2]-$size[0]);
    $dy = abs($size[5]-$size[3]);
    $xpad=9;
    $ypad=9;
     $im = imagecreate(400,400);
    $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
    $black = ImageColorAllocate($im, 0,0,0);
    $white = ImageColorAllocate($im, 176,0,0);
    $font= "Adventure.ttf";
    ImageTTFText($im, $s, 0, (int)($xpad/2)+22, (int)($ypad/2)-8, $black, $font, $text);
    ImageTTFText($im, $s, 0, (int)($xpad/2)+10, (int)($ypad/2)+9, $white, $font, $text);
    Imagepng($im);
 ImageDestroy($im);
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-30 10:25 UTC] danradigan at yahoo dot com
the file adventure.ttf is in the same dir as the script --Dan
 [2000-10-18 07:51 UTC] dbeu@php.net
fixed in cvs
 [2001-07-23 19:45 UTC] danradigan at yahoo dot com
Bug has reappeared in 4.0.6 when i downloaded the zip version of PHP.
 [2001-07-27 13:06 UTC] sniper@php.net
And this should be fixed (again) in CVS now.

--Jani

 [2002-03-12 15:02 UTC] enemybuster at hotmail dot com
There it is again...

I'm using mod_php4.1.2 on SuSE Linux with freetype2 and a patched version of gd 2.0.1b to allow gif support.

I, expieriencing the same problem. If the $font-parameter of the ImageTTFText is a relative path, I get the error message "Could not find/open font". It used to work fine with the old version of gd. So this might be an gd issue...

Anyway, a work-around is quite simple: Just do a realpath($font) and it will work (at least it does for me).

Felix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC