[whatwg] Adding descent to TextMetrics
Charles Pritchard
chuck at jumis.com
Tue Aug 10 17:22:18 PDT 2010
On Aug 10, 2010, at 4:09 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Thu, 8 Jul 2010, Charles Pritchard wrote:
>>
>> We've been doing some work with html line boxes; mainly, mixed font
>> styles in a text area, using the HTML Canvas element. While Canvas
>> fillText does have the textBaseline attribute, in order to set the
>> current alignment, it does not provide enough metrics through the
>> measureText function for us to exploit the textBaseline attribute across
>> fonts (sizes and styles).
>>
>> Adding descent, to the measureText object would allow us to do more.
>> Currently, TextMetrics only returns "width". I'm proposing adding
>> "descent" to that list.
>
> I recommend not using <canvas> for text editing.
I've worked on a substantial amount of code dealing with text editing. At present, the descent of the current font has been the only deficiency.
I feel that using Canvas to implement HTML5/CSS provides a quality proof of the completeness of the 2D API.
>
> Adding more features to TextMetrics is on the cards for a future version
> of the canvas API, but at the moment I'm waiting until more of the spec is
> reliably implemented before adding more features, so that we don't get too
> far ahead of the spec.
We're fine simply including a table of descent metrics (they're essentially a single static value for each font).
Exposing the metric value is a very simple process for implementors (low cost in time to implementation).
I understand that the Canvas spec is essentially frozen (though this seems like a deficiency in the standard [why have textBaseline without it?]) -- I'd like to see some place to discuss the future standard, so as to avoid x-vend-descent as the property value.
>
> --
> Ian Hickson U+1047E )\._.,--....,'``. fL
> http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
> Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list