Andrew Robinson on wrote...
| How can I determine the font metrics for a string? I am
trying to center
| the string "Play", but I find that the text is
vertically misplaced by
| the height of the descender of the "y". How do
I determine the height of
| the descender?
|
Using the command line, not easilly.
An API like PerlMagick, is usally better for this sort of
thing.
The best way is to draw the font using '-annotate' on a
specify baseline
then trim to find the owest point of the letters trimmed, or
draw it
with a bounding box (-box color) set to fins the fonts
defined decender.
See the last areas of
Text to Image Handling
http://www.cit.gu.edu.au/~anthony/graphics/imagick6/tex
t/
Sepecifically "Auto Sized using 'Undercolor
Box'"
http://www.cit.gu.edu.au/~anthony/graphics/imagick
6/text/#size
In these examples I use the bounding box of a font in a
number of ways.
I quote...
By drawing the text with the desired font and size, with a
"-box"
setting, then using "-trim", you can then
figure out not only the
overall bounding height and length of your text in pixels,
but also
the baseline height for that text within the bounding box.
Note that you need to get the size and offset the -trim
produced
when it trimed down to the bounding box size, so output the
image info
of the result, without using +repage.
Anthony Thyssen ( System Programmer ) <A.Thyssen griffith.edu.au>
-----------------------------------------------------------
------------------
Ok, pop quiz. There's a server on a bus. It's rigged
to blow
if it drops below 50 transaction per second. What do
you do?
--- WWW-Speed Home Page -- Simon
Spero (ses unc.edu)
-----------------------------------------------------------
------------------
Anthony's Home is his Castle http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|