Edit report at http://bugs.php.net/bug.php?id=25132&edit=1

 ID:               25132
 Comment by:       f at endeer dot cz
 Reported by:      mail_fidel at yahoo dot com
 Summary:          if compiled with  --enable-gd-native-ttf images with
                   ->accents show font errors
 Status:           No Feedback
 Type:             Bug
 Package:          GD related
 Operating System: FreeBSD 4.7
 PHP Version:      4.3.3RC2
 Assigned To:      pajoye

 New Comment:

The problem with accents has been reintroduced, but this time it's not
--enable-gd-native-ttf, but --enable-gd-jis-conv which is causing this.
Verified on PHP 5.2.13.


Previous Comments:
------------------------------------------------------------------------
[2009-11-11 10:27:33] itsme at tomkiss dot net

Just to report - I have also experienced this problem on varying 

versions of PHP (5.2.6 on MAMP on Mac and 5.2.11 on CentOS).



The example script on PHP.net for imagettftext produced the same result


listed here previously = Accents and extended character sets (Polish for


example) are all missed out or some characters displayed incorrectly 

when --enable-gd-native-ttf is enabled in the PHP compile.



Would be nice to fix this, looks like it's been around a while!

------------------------------------------------------------------------
[2003-08-26 00:59:27] sni...@php.net

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.



------------------------------------------------------------------------
[2003-08-21 06:33:40] paj...@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] paj...@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





------------------------------------------------------------------------


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/bug.php?id=25132


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=25132&edit=1

Reply via email to