[mythtv-users] [magick-users] Font metrics

Andrew Robinson awrobinson-ml at nc.rr.com
Mon Jun 5 02:07:58 UTC 2006


Anthony Thyssen wrote:
> Andrew Robinson on  wrote...
> | Anthony Thyssen wrote:
> | > 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.
> | > 
> 
> After our discussion the baseline determination from command line, was
> worked out and added as an example.  Same area as the links above.
> 
> Still an API method is a lot faster and probably more accurate.
> 
> You may also be able to use other programs for this info,
> I think 'fontforge' can do that, but don't know how.
> 

Anthony, I've been studying your example and I think there is a typo. At 
least I hope so. In the paragraph following the example, you use both 
the numbers 42 and 48 in reference the distance from the top of the 
image to the top of the font box. I think the correct number is 42. It 
drove me crazy trying to figure out where the 48 came from :).

Please take this nit-picking as appreciation for the work you put into 
the example. I realize using an API would be more accurate, but I want 
to do this from the command line to make it more portable. I'm trying to 
build a set of scripts that will automate the process of creating a DVD 
using dvdauthor from recordings made in MythTV.

Andrew


More information about the mythtv-users mailing list