[whatwg] Enabling LCD Text and antialiasing in canvas

Gregg Tavares gman at google.com
Fri Mar 15 21:52:44 PDT 2013


Let me ask again in a different way ;-)  Specifically about LCD style
antialiasing.

What about a context attribute "antialiasRenderingQualityHint" for now with
2 settings "default" and "displayDependent"

   context.antialiasRenderingQualityHint = "displayDependent"

I'm thinking of it like this. The canvas spec does not say how antialiasing
works or even that it exists so right now a UA is free to antialias in
anyway it sees fit. It can do no antialiasing. It can do LCD antialiasing.
It can do alpha antialiasing. It can use different algorithms. In fact, the
software rasterizers between Firefox and Chrome already antialias different
as do different GPUs.

All we're looking for is some way to hint that we'd prefer LCD antialiasing
if the UA thinks it's best for a given situation. We already can't count on
a certain quality or algorithm

   context.antialiasRenderingQualityHint = "displayDependent"

The advantage to this hint is that

   (a) a UA is free it ignore it and rendering will not be any worse/better
than it is now

 and

   (b) as the world moves to HD-DPI everywhere UAs will pick alpha-AA and
things just magically work.

As for rotating, scaling, blending a cavnas it's up to the app to opt into
this hint and it's up to the UA when to honor it.

I'm not seeing the downside here. You're not breaking anything because the
app already has no idea what kind of AA a UA is using. The hint is forward
compatible as well.

The only place I see an issue is UA zooming. But if the app really cares
and if we really care we can provide an API to figure out the zoom level.
Then an app that cares can change the size of their canvas's backingstore
so its 1:1 device pixels for a given zoom level and re-render. Lots of apps
would like to do that with or without the proposed "hint" as it would let
them zoom in a way that matches the text and svg on the page.

Everybody wins! :-)












   1) not ant alias
   2) antialias in any way it sees fit

  could happily implement LCD style AA and still be spec complien



More information about the whatwg mailing list