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

 ID:               50971
 Comment by:       sidhe at rocketmail dot com
 Reported by:      sks76543210 at gmail dot com
 Summary:          imagettftext/imagettfbbox return wrong coordinates if
                   angle != 0
 Status:           Assigned
 Type:             Bug
 Package:          GD related
 Operating System: CentOS 5
 PHP Version:      5.*, 6
 Assigned To:      tabe

 New Comment:

Bug #51263 is reported for PHP 5.3.*, but is also an issue for 5.2.13,
and appears to be related to this issue.


Previous Comments:
------------------------------------------------------------------------
[2010-02-12 23:38:47] paj...@php.net

Tabe, can you look at this one too? I get the feeling that it is fixed
already, by your last commit there.

------------------------------------------------------------------------
[2010-02-12 22:35:22] jvp at 4ssl dot us

*****     failures from 'make test' of 5.2.12     *****

these types of problems keep recurring (since 2001) so it seems that svn
changes sometimes never make it to a stable release or there is no
co-ordination with gd developers to prevent them from popping up again.



i am normally happy with the centos lag away from fresh releases, but i
need at least 5.2.12 for nginx and that is why i am trying to compile
from source.



     1.) 'Bug #43073/#48732 (TrueType bounding box is wrong for
angle<>0) [ext/gd/tests/bug43073.phpt]';

     2.) 'Bug #48801/#48732 (Problem with imagettfbbox)
[ext/gd/tests/bug48801.phpt]'; also (maybe)

     3.) 'Test imagecolorallocate() function : usage variations  -
passing different data types to fourth argument
[ext/gd/tests/imagecolorallocate_variation4.phpt]'



using:

     Linux 2.6.18-128.1.1.el5.028stab062.3 

     #1 SMP MSD 2009 x86_64 x86_64 x86_64 GNU/Linux 

     2.0.33 of gd.x86_64, gd-devel.x86_64, & gd-progs.x86_64

     2.2.1 of freetype.x86_64 & freetype-devel.x86_64

     5.1.0 of t1lib.x86_64 & t1lib-devel.x86_64



     .\configure        \

        --disable-cgi   \

        --disable-ipv6          \

        --enable-bcmath         \

        --enable-calendar       \

        --enable-dom            \

        --enable-exif           \

        --enable-fastcgi        \

        --enable-force-cgi-redirect     \

        --enable-ftp            \

        --enable-gd-jis-conv    \

        --enable-gd-native-ttf          \

        --enable-json           \

        --enable-pdo    \

        --enable-short-tags     \

        --enable-soap           \

        --enable-sockets        \

        --enable-zip    \

        --with-Xpm-dir          \

        --with-apxs2=\usr\sbin\apxs     \

        --with-bz2      \

        --with-curl     \

        --with-db4      \

        --with-freetype-dir     \

        --with-gd       \

        --with-gettext          \

        --with-imap     \

        --with-imap-ssl         \

        --with-jpeg-dir         \

        --with-kerberos         \

        --with-libdir=lib64     \

        --with-mcrypt           \

        --with-mhash    \

        --with-mysql    \

        --with-mysql-sock       \

        --with-mysqli   \

        --with-ncurses          \

        --with-pdo-mysql        \

        --with-png-dir  \

        --with-pspell   \

        --with-snmp     \

        --with-t1lib    \

        --with-ttf      \

        --with-xpm-dir  \

        --with-xsl      \

        --with-zlib-dir

--

thank you,



johann

------------------------------------------------------------------------
[2010-02-09 13:04:41] sks76543210 at gmail dot com

The bug occurs in the two PHP versions I have available to test on here.
Perhaps I can try on a win32 box when I get to work.



PHP 5.3.3-dev compiled from src

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

GD Version: bundled (2.0.34 compatible)

Freetype Version: 2.2.1



./configure  --with-apxs2=/home/user/bin/httpd/bin/apxs
--prefix=/home/user/bin/php --with-pdo-mysql --with-zlib --with-gd
--with-gettext --with-freetype-dir --enable-gd-native-ttf







PHP 5.1.6 from centos rpms

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

GD Version: bundled (2.0.28 compatible) 

FreeType Version 2.2.1

------------------------------------------------------------------------
[2010-02-09 09:53:59] paj...@php.net

Which GD library do you use? Bundled?

------------------------------------------------------------------------
[2010-02-09 06:39:41] sks76543210 at gmail dot com

Description:
------------
imagettftext() and imagettfbbox() both return wrong bounding box if the
angle is not set to 0. This sounds similar to a bug closed last year at
http://bugs.php.net/bug.php?id=43073



See http://www.yessum.org/gdbug2/ for font and samples. This bug appears
to be in 5.1.6, and has since gotten worse in the latest svn. 



Also, in 5.3.3-dev, the text doesn't seem to even be on the same
baseline on many of the angles.

Reproduce code:
---------------
<?php

    $font = './cour.ttf'; // Courier New

    

    $im = imagecreatetruecolor(600, 600);

    

    imagefill($im, 0, 0, imagecolorallocate($im, 224, 224, 224));

    $black = imagecolorallocate($im, 0, 0, 0);

    $red = imagecolorallocate($im, 255, 0, 0);

    

    $angle = 0;

    do {

        $bbox = imagettftext($im, 16, $angle, 299, 299, $black, $font,
'The quick brown fox');

        imagepolygon($im, $bbox, 4, $red);

        $angle += 45;

    } while ($angle < 360);

    

    header('content-type: image/png');

    imagepng($im);

Expected result:
----------------
The bounding box should be a bounding box

Actual result:
--------------
The string is not contained in the bounding box.


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



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

Reply via email to