php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27693 imagettftext() coupled with imagecreatetruecolor() displays yellow fonts.
Submitted: 2004-03-25 08:49 UTC Modified: 2004-04-15 20:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: xavier dot blanchet at free dot fr Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: xavier dot blanchet at free dot fr
New email:
PHP Version: OS:

 

 [2004-03-25 08:49 UTC] xavier dot blanchet at free dot fr
Description:
------------
When we use the imagecreatetruecolor() function, the imagettftext() and a TrueTypeFont with such a phpinfo(): 

http://240plan.ovh.net/test.php

The fonts expected in black display yellow, the other specified colors are invisible. 



Reproduce code:
---------------
<?php 
DEFINE("TTF_DIR","path/to/fonts/");
$im = imagecreatetruecolor (400, 100);
$black = imagecolorallocate ($im, 0, 0, 0); 
$white = imagecolorallocate ($im, 255, 255, 255);
imagefilledrectangle($im,0,0,399,99,$white);
imagettftext ($im, 30, 0, 10, 40, $black, TTF_DIR."arial.ttf", "Hello World!");
header ("Content-type: image/png"); 
imagepng ($im);
?>

Expected result:
----------------
Hello World! should be written in black

Actual result:
--------------
Hello World! is written in yellow 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-26 15:01 UTC] iliaa@php.net
Works fine with latest CVS. 
 [2004-04-01 07:23 UTC] sandeep at highimpactsites dot com
i m facing the same problem.

Text are shown in yellow color even if we have assign the black color. and text dosen't appear on image using ImageTTFText function.

It is working fine on PHP Version 4.3.2 & GD Version  bundled (2.0.12 compatible)  but facing above mention problem with  PHP Version 4.3.5 & GD Version  2.0 or higher  Also with PHP Version 4.3.5 & GD Version  bundled (2.0.17 compatible).
 [2004-04-01 07:47 UTC] xavier dot blanchet at free dot fr
I was hoping PHP 4.3.5 would resolve the bug, but as I tried the same script on PHP Version 5.0.0b2 Beta ( http://240plan.ovh.net/test.beta ) and faced the same problem, i did not believe in a PHP version 4.3.5 working fine with ttf fonts... According to Sandeep, I was right :-(
 [2004-04-01 11:56 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I am still unable to replicate the problem using the Arial 
ttf font avaliable on my system. Please include your 
configure line in your reply. 
 [2004-04-03 09:51 UTC] nlopess@php.net
I can't reproduce either with PHP 4.2.6RC2-dev.

I think the problem may be only with Unicode fonts, althought it works for me.
 [2004-04-05 09:56 UTC] xavier dot blanchet at free dot fr
For me on Windows, it all works fine.
On Linux I cannot try the latest version before my hoster (OVH.com) has migrated :-( But as I have already mentionned the beta version PHP5 ( http://240plan.ovh.net/test.beta )returns these same yellow fonts.

However I noticed something interessting: each time i met someone in forums, newsgroups... experiencing the same problem, the FreeType Linkage in the phpinfo() was with "TTF Library". "with FreeType" is ok...
 [2004-04-05 11:01 UTC] derick@php.net
ttf = freetype 1, old and buggy
freetype = freetype 2, new, not buggy

So just compile PHP against the newer version, not a bug -> bogus.
 [2004-04-15 20:35 UTC] cartoonlad at thesnakefarm dot com
So for those of us who are muddling around with configuring php for the first time, what does that mean?  Use --enable-gd-native-ttf in the configure?
 [2004-04-15 20:47 UTC] pajoye@php.net
"On Linux I cannot try the latest version before my hoster (OVH.com) has migrated :-( But as I have already mentionned the beta version PHP5 (http://240plan.ovh.net/test.beta )returns these same yellow fonts."

"FreeType Version 1.3"... just forget it sorry.

Then even when they upgrade it (in some servers, as I got one) it was the version "2.0", with which gd has some bugs with rotated text. I used a dedicated server there, so I upgraded myself to a recent version (2.1.7). Everything is fine since.

So please keep this bug quiet and ask support questions on the right list (ie, php-install) or beg your ISP to upgrade to a recent freetype.

hth

pierre
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 02:01:31 2024 UTC