Bug #12956 Updated: libgd2 + TTF = ugly fonts.
| From: | wez@php.net | Date: | Sun, 26 Aug 2001 07:45:33 +0000 |
| Subject: | Bug #12956 Updated: libgd2 + TTF = ugly fonts. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-64334@lists.php.net to get a copy of this message | ||
ID: 12956
Updated by: wez
Reported By: php-bugs@c0de.net
Old Status: Open
Status: Closed
Bug Type: GD related
Operating System: Debian GNU/Linux
PHP Version: 4.0CVS-2001-08-25
New Comment:
It's a GD bug; I know this because my patched GD works fine with TTF. I submitted the patch to
the GD folks a while ago.
--Wez.
Previous Comments:
------------------------------------------------------------------------
[2001-08-25 21:12:15] rasmus@php.net
How do you know? All I said was that this was known, but that I don't know what causes
truecolour images to not support anti-aliasing. ie. whether the bug is in PHP or GD or a
combination of both is yet to be determined.
------------------------------------------------------------------------
[2001-08-25 20:59:40] sniper@php.net
Not a PHP bug then..
--Jani
------------------------------------------------------------------------
[2001-08-25 16:59:27] rasmus@php.net
Yes, this is known. Anti-aliasing of TTF fonts in GD2 only works with paletted images. No idea
why. Try asking the GD folks.
------------------------------------------------------------------------
[2001-08-25 13:47:49] php-bugs@c0de.net
More on the problem. (This could be a libGD bug, but the libGD test works fine, but I'm not
sure if its doing the same thing)
This is from the ./configure to show that it is configured right (I have removed some lines to make
it shorter):
checking whether to include GD support... yes
checking whether to enable truetype string function in gd... yes
checking for freetype(2)... yes
checking whether to include include FreeType 1.x support... no
checking whether to include T1lib support... yes
checking for T1_LoadFont in -lt1... yes
checking for gdImageCreateFromPng in -lgd... yes
checking for gdImageCreateFromJpeg in -lgd... yes
checking for gdImageCreateTrueColor in -lgd... Yes
So here is the script:
<?php
Header ("Content-type: image/jpeg");
$im = imagecreatetruecolor (400, 30);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 20, 0, 10, 20, $white, "/Fonts/arial.ttf", "Testing... Omega:
Ω");
ImageJPEG ($im);
ImageDestroy ($im);
?>
I have also found out if I do not use truecolor, then the font is ok, but if I create from a jpeg or
png, I get crap fonts. I guess its a truecolor problem. I dont know if it is in PHP or in GD.
Maybe I'm posting this to the wrong place. Is anyone else using libGD2 and truecolor TTF
graphics?
Here is some samples that I made: http://rtfm.c0de.net/helpfiles/ttf-test.html
Thank you for your help.
------------------------------------------------------------------------
[2001-08-25 07:50:48] sniper@php.net
First, create a short but complete example script and
include it here so we can test it.
Second, you should use the correct paths for the configure
options:
--with-freetype-dir=/usr
And btw. This configure option is for freetype2.
( --with-ttf is for freetype 1.x )
Also note that GD2 is in BETA.
This might instead being a bug in PHP, be a bug in GD2.
--Jani
------------------------------------------------------------------------
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/?id=12956
Edit this bug report at http://bugs.php.net/?id=12956&edit=1