#25132 [Fbk->NoF]: if compiled with --enable-gd-native-ttf images with ->accents show font errors
| From: | sniper@php.net | Date: | Tue, 26 Aug 2003 05:59:28 +0000 |
| Subject: | #25132 [Fbk->NoF]: 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-46642@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: Feedback
+Status: No Feedback
Bug Type: GD related
Operating System: FreeBSD 4.7
PHP Version: 4.3.3RC2
Assigned To: pajoye
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
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 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
------------------------------------------------------------------------
[2003-08-18 12:50:12] mail_fidel at yahoo dot com
Description:
------------
If when compiling you use the: --enable-gd-native-ttf then you will
have trouble with accents in graphics.
The behavior is as follows:
Lets say you want an image with the words: "hello world". I works as
espected and you get the text right.
Now if you want the words: "buen día" (pay attention to the accent over
the "i") then, the text that displays on the image is "buen d a" not
only the accented charanter disapeared but also the next character.
If you remove the config option (--enable-gd-native-ttf) then php
behaves as before.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25132&edit=1