#29249 [Opn->Fbk]: imagettfbbox / imagettfbbox returning wrong values w/ linebreaks
| From: | sniper@php.net | Date: | Fri, 14 Jan 2005 23:43:00 +0000 |
| Subject: | #29249 [Opn->Fbk]: imagettfbbox / imagettfbbox returning wrong values w/ linebreaks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72202@lists.php.net to get a copy of this message | ||
ID: 29249
Updated by: sniper@php.net
Reported By: kees at tweakers dot net
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Linux
PHP Version: 5.0.0
New Comment:
I think you need to pass the string with double quotes:
bounds = imagettfbbox(8, 0, 'tahoma.ttf', "j\nj");
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/?id=29249&edit=1