List Info

Thread: Font metrics




Font metrics
user name
2006-05-28 04:25:16
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?

Thanks!

Andrew Robinson
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
Font metrics
user name
2006-05-29 05:43:46
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.Thyssengriffith.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 (sesunc.edu)
 -----------------------------------------------------------
------------------
     Anthony's Home is his Castle     http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
Font metrics
user name
2006-05-29 06:36:06
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?
| 
Examples updated...

See 
  Determining Font Information
     http://www.cit.gu.edu.au/~anthony/graphics/im
agick6/text/#font_info

  Anthony Thyssen ( System Programmer )    <A.Thyssengriffith.edu.au>
 -----------------------------------------------------------
------------------
     Wecome to the Internet Scratch-It       ###  ###  ### 
###  ###  ###
     Any three matches to win!   -------->   ###  ### 
###  ###  ###  ###
 -----------------------------------------------------------
------------------
     Anthony's Home is his Castle     http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )