W3C home > Mailing lists > Public > www-style@w3.org > August 2010

Font Metrics

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 10 Aug 2010 17:48:34 -0700
Message-ID: <4C61F362.8030905@jumis.com>
To: www-style@w3.org
Is there a currently accepted API for querying font metrics from CSS?

With web fonts support available in most browsers; and Canvas also 
supported,
we're now able to do quite a few interesting things with text.

One issue I'm coming across, however, has to do with measuring the 
descent of a font,
so that I may properly use the textBaseline attribute of the Canvas 2D 
Context.

Canvas 2D TextMetrics are very minimal, for good reason.

I can adequately process the height and width of text I'm displaying,
but I can't align two different font sizes on the same baseline without
hand-coding font metrics [mainly, descent].

It seems to me that an API for selecting such information may, most 
appropriately,
via CSS, and DOM methods like getComputedStyle.

I've been suggesting such information be added into Canvas 2D Context 
TextMetrics,
but having thought about it more, I think CSS is a more appropriate avenue.

-Charles
Received on Wednesday, 11 August 2010 00:49:21 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:30 GMT