note 62428 added to function.imagettfbbox
| From: | toe dot cutter at telia dot com | Date: | Tue, 28 Feb 2006 15:41:18 +0000 |
| Subject: | note 62428 added to function.imagettfbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104560@lists.php.net to get a copy of this message | ||
Neither Greg's or Henrik N's code worked for me.
I figured out that imagettfbbox gives the size (coordinates) of the whole letter (ie. with the hang
on 'g' or 'j'). So it was only a matter of finding the correct index of
coordinates in the array.
Note: This doesn't work on Times New Roman Italic's 'f' for some reason.
<?php
$size = imagettfbbox($fontsize, 0, $font, $text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
ImageTTFText($im, $fontsize, 0, abs($size[6]), abs($size[5]), $txtcolor, $font, $text);
?>
----
Server IP: 193.27.201.10 (proxied: 193.27.201.10 1.0 www1.shellkonto.se:3128 (squid/2.5.STABLE4))
Probable Submitter: 212.112.164.219
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.imagettfbbox.php
Edit -- http://master.php.net/note/edit/62428
Del: integrated -- http://master.php.net/note/delete/62428/integrated
Del: useless -- http://master.php.net/note/delete/62428/useless
Del: bad code -- http://master.php.net/note/delete/62428/bad+code
Del: spam -- http://master.php.net/note/delete/62428/spam
Del: non-english -- http://master.php.net/note/delete/62428/non-english
Del: in docs -- http://master.php.net/note/delete/62428/in+docs
Del: other reasons-- http://master.php.net/note/delete/62428
Reject -- http://master.php.net/note/reject/62428
Search -- http://master.php.net/manage/user-notes.php