[whatwg] Requesting TextMetrics baseline property

I'd like to see a new property added to the TextMetrics object from 
Canvas 2d.

var t = ctx.measureText('text span');
t == { width: int, baseline: int };

The baseline corresponds to the vertical offset of the anchor point.
A tiny number. It's not the same as height, but it has a similar use.

It allows allows the author to manage style markers on spans of text 
presenting different baselines.

The following textBaseline image can not be generated in canvas:
https://developer.mozilla.org/en/drawing_text_using_a_canvas
http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png

It can, but we have to do css hacks/edge detection, as measureText is 
insufficient.
By exposing the baseline offset in the TextMetrics method, we would be 
able to generate
the lines in that image, and appropriately position the text captions.

It seems appropriate that the illustration for textBaseline be something
that can be easily generated from within canvas. The same standard is held
for SVG documentation.

-Charles

Received on Tuesday, 30 August 2011 15:19:31 UTC