Text ascent, descent and x-height

Hi all,

For my research I'm currently working on a high-level, compositional image API in the purely functional programming language Clean. We are using SVG as back-end, i.e., we are generating SVG from this high-level image description.

In order to successfully generate images containing text, we need access to font metrics. Currently, SVGTextContentElement already defines getComputedTextLength, amongst others. However, to accurately position text in an image, we also need access to a font's ascent, descent and x-height. While this information is already present in the form of an attribute on the font-face element, I would like to be able to access this information for any given text, even if I haven't manually defined the font in a font-face element. In particular, I would like to see the following additions to SVGTextContentElement:

interface SVGTextContentElement : SVGElement, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable {

 (snip)

 float getComputedTextAscentHeight();
 float getComputedTextDecentHeight();
 float getComputedTextXHeight();
};

Would this be possible? What are the technical hurdles for such an API? Also, what is the formal procedure for proposing such API changes?

Cheers,

Jurriën

P.S. My apologies if this has already been thoroughly discussed; I'm new to this list :)
P.P.S. Sorry if this message hits the list twice; the mailing list seems to have eaten the first copy several hours ago, but it may just be stuck in the email pipeline

Received on Tuesday, 11 November 2014 00:01:46 UTC