|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-18 12:50 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
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").