[whatwg] 2D canvas feature proposal: text decoration

Ian Hickson ian at hixie.ch
Tue Jan 21 14:12:45 PST 2014

On Mon, 30 Sep 2013, Justin Novosad wrote:
> On Fri, Sep 27, 2013 at 5:05 PM, Ian Hickson <ian at hixie.ch> wrote:
> > >
> > > Text decoration can theoretically be drawn directly by the 
> > > application by using font metrics to compute decoration positions, 
> > > but this is often very complex to do correctly in a truly portable 
> > > way.
> >
> > We could add underline metrics to TextMetrics if that would help.
> Perhaps that would be the right solution, but I don't know enough about 
> metrics to authoritatively state what information is missing. The fact 
> that most browsers do not fully support the text metrics as currently 
> spec'ed does not help either (I know, Chrome is one of the worst 
> offenders w.r.t. metrics support).

Sure. They don't support drawing underlines either. Browsers typically 
don't support features when they're added to a spec, except for cases 
where the spec is describing proprietary features that ended up being 
adopted by other browsers as well.

> > If doing things with CSS and the DOM is too slow, then we should fix 
> > that, we shouldn't just tell people to rewrite their apps in <canvas>.
> Easier said than done.

Well, sure. Most things here are.

> In theory, it should be possible to obtain canvas-like performance when 
> DOM usage is constrained to styles that make layout calculations trivial 
> (as in no-op).

It's quite possible that the solution is not to use DOM, but to provide 
some different mechanism that is more structured and semantic than canvas 
but more rigid and less flexible than DOM.

> However, this is still a more or less unsolved problem despite the best 
> efforts of a large number of very smart people.  Let's not hold our 
> breaths.

Well, no, let's solve it instead.

Having people move from a high-level, highly flexible, semantically rich, 
media-independent model to a low-level, medium-specific, mostly semantic- 
free model just because of performance issues seems like a huge loss.

Solving this means working out the use cases we want to address, figuring 
out what the requirements are, and then coming up with models to address 
them. So let's do that. First, what are the use cases we want to address?

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