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

 ID:                 29249
 Comment by:         cirus dot minor at free dot fr
 Reported by:        kees at tweakers dot net
 Summary:            imagettfbbox / imagettfbbox returning wrong values
                     w/ linebreaks
 Status:             No Feedback
 Type:               Bug
 Package:            GD related
 Operating System:   Linux
 PHP Version:        5.0.0
 Block user comment: N
 Private report:     N

 New Comment:

Reproduced with php 5.3.10 on windows


Previous Comments:
------------------------------------------------------------------------
[2007-01-28 05:51:30] spam at dtdsoft dot com

This bug is still present in PHP 5.2.0 (Running on Windows XP) I am posting 
this to reactiveate the bug and make it known that it is still present.

~DtD
BTW> I fixed it by multiplying the height by 
substr_count($string,"\n")+1)

------------------------------------------------------------------------
[2005-01-22 01:00:17] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2005-01-15 00:42:59] [email protected]

I think you need to pass the string with double quotes:

bounds = imagettfbbox(8, 0, 'tahoma.ttf', "j\nj");



------------------------------------------------------------------------
[2004-07-19 03:26:46] kees at tweakers dot net

Actual result should be:
--------------
Both will give the same result, a box of x: 15 y: 12.

------------------------------------------------------------------------
[2004-07-19 03:24:20] kees at tweakers dot net

Description:
------------
The imagettfbbox / imagettftext should return an array with the boundaries on 
texts. This works fine with a single string, but if you use a multiline string 
(with \n in it) it fails to report the actual size, and returns the size / box 
of a single line.

The string _is_ writen normally on the image, ie; with a newline instead of an 
\n, but the sizes are wrong.

Reproduce code:
---------------
// string with a line break, try imagettftext, it'll put the correct string on 
the image, but return the wrong results
$bounds = imagettfbbox(8, 0, 'tahoma.ttf', 'j\nj');
print_r($bounds);

// no line break here, just a \ instead of a /, which is the same size.
$bounds = imagettfbbox(8, 0, 'tahoma.ttf', 'j/nj');
print_r($bounds);

Expected result:
----------------
The first line should return something like a box with an x/y of 3 / 26 (or 
close), the second result should return (and does ;)) an x/y box of 15 / 12.


Actual result:
--------------
Both will give the same result, a box of x: 15 y: 26.


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



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

Reply via email to