#17666 [Com]: TTF-Fonts does not work
| From: | peter at kapege dot de | Date: | Fri, 23 May 2003 08:09:06 +0000 |
| Subject: | #17666 [Com]: TTF-Fonts does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40250@lists.php.net to get a copy of this message | ||
ID: 17666
Comment by: peter at kapege dot de
Reported By: ulf at ecora dot de
Status: Closed
Bug Type: GD related
Operating System: WinXP/Suse Linux
PHP Version: 4.2.0
New Comment:
My provider has php 4.2.3 and I sorrily can't upgrade his php... ;-)
My code is this:
...
$bild = $_GET["bild"];
header("Content-type: image/png");
$img = imagecreatefrompng("../bin/B_Jahr.png");
$hc = imagecolorallocate($img,0,0,0);
$tsize = 11;
$xpos = 7;
$ypos = 15;
imagettftext($img,$tsize,0,$xpos,$ypos,$hc,"../bin/comic.ttf",$bild);
imagepng($img);
imagedestroy($img);
...
and it worked fine until my provider upgraded the version to 4.2.3.
It's a huge German provider (1&1) and they are not able to upgrade
quickly.
Is there any workaround for the ttf-problem instead?
Absolute path didn't work.
Thankful
Peter
Previous Comments:
------------------------------------------------------------------------
[2002-07-09 12:47:56] ulf at ecora dot de
I believe this bug is not fixed.
Script E:\try\test\test.php
Font E:\try\gd\font.ttf
putenv("GDFONTPATH=E:\try\gd\");
imagettftext($im, 20, 0, 10, 5, $grey, 'font.ttf', 'beep');
Apache.exe tried to open E:\try\gd\e:\try\test\font.ttf.ttf
putenv("GDFONTPATH=");
imagettftext($im, 20, 0, 10, 5, $grey, 'font.ttf', 'beep');
Apache.exe tried to open C:\winnt\fonts\e:\try\test\font.ttf.ttf
But my WinXP is in c:\XP. This hardcoded Path (C:\winnt\) is a bad
idea.
------------------------------------------------------------------------
[2002-06-22 12:43:22] mfischer@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
You have to set the GDFONTPATH environment variable before yuo call the
ttftext function, e.g.
putenv("GDFONTPATH=...");
but chances may be that it doesn't work with the gd version 4.2.0 is
linked against.
However this is fixed in
http://snaps.php.net/win32/php4-win32-latest.zip
, so closing.
------------------------------------------------------------------------
[2002-06-22 11:55:23] ulf at ecora dot de
@mfischer:
I made a test with file_monitor on WinXP.
TestScript:
<?PHP
$im = imagecreate(420,315);
$grey = imagecolorallocate($im, 60, 60, 60);
imagettftext($im, 80, 0, 20, 50, $grey, 'font.ttf', 'test');
?>
Path of the Testscript: E:\try\test.php4
The php.exe tried to open the fontfile (E:\try\font.ttf) on the
following location:
17:44:45 php.exe FASTIO_QUERY_OPEN
E:\usr\share\fonts\truetype\E:\try\font.ttf.ttf
FAILURE
I have not so much experience, but everywhere in the GD- or in the
FreeType-code must be this fixed path:\usr\share\fonts\truetype\
------------------------------------------------------------------------
[2002-06-09 10:46:57] sniper@php.net
I just had same kind of problem on Linux. And the reason
was that the user my apache runs as did not have read
access to the fonts. So you might wanna check that too.
------------------------------------------------------------------------
[2002-06-09 09:13:17] rasmus@php.net
Try it without the .ttf extension.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/17666
--
Edit this bug report at http://bugs.php.net/?id=17666&edit=1