#25132 [Opn->Fbk]: if compiled with --enable-gd-native-ttf images with ->accents show font errors
| From: | sniper@php.net | Date: | Thu, 21 Aug 2003 12:59:49 +0000 |
| Subject: | #25132 [Opn->Fbk]: if compiled with --enable-gd-native-ttf images with ->accents show font errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46416@lists.php.net to get a copy of this message | ||
ID: 25132
Updated by: sniper@php.net
Reported By: mail_fidel at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: FreeBSD 4.7
PHP Version: 4.3.3RC2
Assigned To: pajoye
Previous Comments:
------------------------------------------------------------------------
[2003-08-21 06:33:40] pajoye@php.net
Can you try this simple script instead?
$im = imagecreatetruecolor(200,200);
$black = imagecolorallocate($im, 255,0,0);
imagettftext($im, 20, 0, 10, 20, $black, "arial.ttf",
"buen día");
imagepng($im, 'res.png');
On which platform do you work?
pierre
------------------------------------------------------------------------
[2003-08-19 10:27:01] mail_fidel at yahoo dot com
This are the config options:
Configure Command => './configure' '--enable-versioning'
'--enable-memory-limit' '--with-layout=GNU' '--with-zlib-dir=/usr'
'--disable-a
ll' '--with-regex=php' '--enable-discard-path' '--enable-bcmath'
'--enable-ctype' '--with-dom=/usr/local' '--with-dom-xslt=/usr/local'
'-
-with-dom-exslt=/usr/local' '--enable-filepro' '--with-gd'
'--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=
/usr/local' '--with-xpm-dir=/usr/local' '--with-imap=/usr/local'
'--with-imap-ssl=/usr/local' '--enable-mbstring' '--enable-mbregex'
'--w
ith-mysql=/usr/local' '--enable-overload' '--with-pcre-regex=yes'
'--enable-posix' '--with-readline' '--enable-session'
'--enable-tokeniz
er' '--enable-xml' '--with-expat-dir=/usr/local'
'--with-zlib=yes'
'--prefix=/usr/local' 'i386-portbld-freebsd4.7'
This is my working built, without --enable-gd-native-ttf
Freetype version:
freetype2-2.1.4_1
Example code:
function getImage($font,$string,$point,$color,$bgcolor)
{
$ses = session_id();
$fileName = $ses."_.png";
$measures = imagettfbbox ( $point, "0", $this->fonts_path.$font,
$string);
$width = abs($measures[4] - $measures[0])+20;
$upper = abs($measures[5])+5;
$under = abs($measures[1])+5;
$height = $upper + $under;
$image = imagecreate($width, $height);
//Allocate some colors.
$color = eregi_replace("#","",$color);
$ri = hexdec(substr($color, 0, 2));
$gi = hexdec(substr($color, 2, 2));
$bi = hexdec(substr($color, 4, 2));
$bgcolor = eregi_replace("#","",$bgcolor);
$rb = hexdec(substr($bgcolor, 0, 2));
$gb = hexdec(substr($bgcolor, 2, 2));
$bb = hexdec(substr($bgcolor, 4, 2));
$bg_color = imagecolorallocate($image,$rb ,$gb,$bb);
$typeface_color = imagecolorallocate($image, $ri, $gi, $bi);
imagecolortransparent($image,$bg_color);
imagefilledrectangle($image, 0, 0, $width, $height, $bg_color);
imagettftext($image, $point, 0, 10, $upper+2,
$typeface_color,$this->fonts_path.$font, $string);
$path = $this->temp_path;
imagepng($image,$path.$fileName);
//Finally, free up the memory allocated for the image.
imagedestroy($image);
return($fileName);
}
when trying to solve the problem we change the image type from png to
gif to jpg to see if this was the problem. We upgrade freetype and GD.
Then I read that php 4.3.3 was using some "recomended" native gd code
and when I saw the --enable-gd-native-ttf I decided to turned off and
the scripts start working again.
I'm sure is not a font related problem, first because it worked just
before the update, and second bacause we have a big library of ttf
fonts and we test it with all of them (since some fonts do not have
accent characters we generate an image with each one to test them)
Also, I made a mistake in the description with the example "buen día"
the output was "buen d ". A customer of us wrote this "todo por tus
células" and the output was: "todo por tus c ulas". If any one knows
spanish he/she can realize how embarrassing and funny is is (original
text "all for your cells" output text "all for you ass").
------------------------------------------------------------------------
[2003-08-18 18:31:23] pajoye@php.net
everythings works fine here. Using bundled GD library, freetype 2.1.3
and the standart arial windows font.
Send the required infos asap if you still reproduce this bug using
freetype2 (last release or 2.1.3+) and bundled GD.
pierre
------------------------------------------------------------------------
[2003-08-18 16:35:32] moriyoshi@php.net
Also, let us know what parameter you specified to configure. it's
possible you turned on jis-conv feature
with --enable-gd-jis-conv.
------------------------------------------------------------------------
[2003-08-18 15:14:16] pajoye@php.net
hello,
do you have the ttf font used by your script?
What do you mean by "not only the accented charanter disapeared but
also the next character"?
"buen día" and "buen d a",only the "i" disapeared.
Which freetype version do you use?
pierre
------------------------------------------------------------------------
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/25132
--
Edit this bug report at http://bugs.php.net/?id=25132&edit=1