Obtaining bounding box for glyphs

Dear SVG editors,

I am building a MathML-to-SVG renderer, and want to add support
for SVG fonts. To do this, I need to access font metrics: in particular,
I need bounding box data for individual glyphs. It is easily obtainable 
from AFMs or TrueType/OpenType font files; but there is no place 
to store it in an SVG font. SVG 1.1 spec explicitly refuses to provide 
bbox values for either glyphs or entire fonts (section 20.2). (The refusal 
looks like an overstatement - at least for the font bounding box, there
is a 'bbox' attribute on 'font-face'. Helas, for individual glyph, no such
expedient exists).

Looks like I need to run an SVG rendering engine in order to compute 
bounding boxes -- definitely not an option for a modest Python script.
On the other hand, support for SVG fonts in a MathML-to-SVG 
converter looks too appealing to discard it easily. What shall I do?
Perhaps run an external application, and build an AFM out of the 
SVG font? Is anyone aware of a tool for this? 

Putting the question more generally - what is the rationale behind 
exclusion of bbox data? It really precludes using SVG fonts as sources
of metric info in applications like mine. And I feel pretty strange 
recoding an SVG font into a legacy AFM...

Regards,
Nikolai Grigoriev 

Received on Thursday, 9 June 2005 21:05:05 UTC