Re: image functions => text alignment
| From: | Miguel Cruz | Date: | Tue, 26 Mar 2002 15:59:20 +0000 |
| Subject: | Re: image functions => text alignment | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90205@lists.php.net to get a copy of this message | ||
On Tue, 26 Mar 2002, Fabio Spinelli wrote:
> Hi all, I'm writing a script that generate invoices in a PNG files.
> My problem is that I have to write the numbers aligned to the right.
> I'm using the funciotn ImageTTFText and it haven't a parm that tells the
> alignment.
> I looked at the IMAGE functions list in www.php.net but I didn't found
> nothing about the alignment.
> Does anyone know if there's a function or a parameter to write with TTF
> fonts aligned to the RIGHT?
First call the function ImageTTFBBox with your text. The array you receive
in response will contain the information you need to calculate the width
of the text ($a[5] - $a[7]). Then just subtract that from your desired
right margin when you draw the text with ImageTTFText.
miguel