Re: GD text positioning




"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


.



Relevant Pages

  • Re: CSS-P ? Is it really any good for SERPS ?
    ... >>using positioning wiht a light-hand versus a heavy one. ... >resize, content does. ... But you have also specified the div sizes in pixels also - so ...
    (alt.internet.search-engines)
  • Re: points vs pixels.
    ... in pixels only to then have to have them unlearn it later. ... absolute co-ordinates in the null layout, the origin 0,0 is the upper left ... "When you place an object on the screen, you specify the location of its ... container": This is not a function of the layout but of the container. ...
    (comp.lang.java.help)
  • Re: Remove speckles in bilevel (bw) image
    ... pixels of B_0. ... be 'bounding box size'. ... pixel rectangle is modified by filling with black ...
    (sci.image.processing)
  • Re: Overlap relative positioned divs
    ... the right hand edge of the box. ... Now i need the second (wider) box to overlap the square and so start ... a gap on the right hand side of 30 pixels, ... to the next line because of the relative positioning. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Seeking digital (image) filter for specific task
    ... width of a few pixels, ... say the upper half of an images is ... has several bright pixels in the upper half. ... intensity, depending on the concentration of Phase A" and "Phase B, where no ...
    (comp.graphics.algorithms)