Re: GD text positioning
- From: "Dave" <daveandniki@xxxxxxxxxxxx>
- Date: Mon, 12 Jun 2006 15:55:54 +0200
"IanW" <whoever@xxxxxxxxxxxxx> wrote in message
news:e6jphr$kv3$1@xxxxxxxxxxxxxxxxxxxxxxxxxx
I am writing some text on an image like this:
$im->stringFT($colour,"c:/winnt/fonts/verdana.ttf",8,0,10,10,"Processor
Usage");
The problem is the positioning. It seems to start 10 pixels from the left
of the image OK, but only 2 pixels down on the y coordinate. In fact, the
coords of the bottom left edge of the "P" in "Processor" is 10,10. Does it
really render it starting from there? That isn't even the bottom-left edge
of the bounding box either, because there's the tail of the "g" to
consider.
Any ideas how can I accurately position the text?
Ian
Yes it does start from there. It also returns the bounding box but you are
throwing away the return value, try:
my $bounds =
$im->stringFT($colour,"c:/winnt/fonts/verdana.ttf",8,0,10,10,"Processor
Usage");
and you will find that:
@bounds[0,1] Lower left corner (x,y)
@bounds[2,3] Lower right corner (x,y)
@bounds[4,5] Upper right corner (x,y)
@bounds[6,7] Upper left corner (x,y)(see the man page of GD for further
details)Dave
.
- Follow-Ups:
- Re: GD text positioning
- From: IanW
- Re: GD text positioning
- References:
- GD text positioning
- From: IanW
- GD text positioning
- Prev by Date: GD text positioning
- Next by Date: Re: best method to perform operations on word lists
- Previous by thread: GD text positioning
- Next by thread: Re: GD text positioning
- Index(es):
Relevant Pages
|