Font metrics support in SVG 1.2

Hi.

Can I suggest that for SVG 1.2 there should be the ability to get some
information about the font metrics used for a particular text element?
In particular I think it would be handy to be able to get the ascent of
the text, as it can make vertically centering text a lot easier.
Bounding box is not sufficient if you want to center to pieces of text
vertically and have them running along the same baseline, if one text
has descenders and the other doesn't.

For example, if you wanted to vertically center the string "Hello" at
(100, 100) and the string "Goodbye" at (200, 100), then the baseline of
the "Goodbye" string is going to be a bit lower than the "Hello" string,
since its bounding box has greater height.  What you really need to do
is get the ascent of these strings and use that value instead of the
height of the bounding box.  This centering will look more natural.

Perhaps a getAscentOfChar method can be added to SVGTextContentElement.

Alternatively, a vertical-text-align property that can be used to do
this type of centering could be added (and would have the benefit of not
requiring script to vertically center text).

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

Received on Tuesday, 10 February 2004 19:42:59 UTC