[whatwg] Enabling LCD Text in 2D canvases.

Fred Andrews fredandw at live.com
Wed Nov 14 17:07:30 PST 2012

The canvas that scripts draw into could be over-sized with the UA down sampling this to
fit the target size and taking into account the sub-pixel screen layout when doing so.


> Date: Wed, 14 Nov 2012 11:09:49 -0500
> From: junov at chromium.org
> To: robert at ocallahan.org
> CC: whatwg at lists.whatwg.org
> Subject: Re: [whatwg] Enabling LCD Text in 2D canvases.
> On Tue, Nov 13, 2012 at 9:37 PM, Robert O'Callahan <robert at ocallahan.org>wrote:
> > On Mon, Nov 12, 2012 at 2:36 PM, Justin Novosad <junov at chromium.org>wrote:
> >
> >> Any thoughts?
> >>
> >
> > We'd have to define what happens when you use subpixel antialiasing
> > "incorrectly", because we can be pretty sure authors will use it
> > incorrectly and expect to get interoperable behavior.
> >
> > Mozilla supports a "mozOpaque" attribute which makes the canvas buffer
> > RGBX (initialized to solid black) and enables subpixel antialiasing for
> > most text drawing. That might be enough to address your use-cases.
> >
> >
> On top of that, subpixel antialiasing would have to get turned off if a
> rotation or scale (or any transform that breaks pixel alignment), is
> applied to the canvas element.
> That is an interesting solution but it is still not 100% safe from the
> author's perspective, since there are still several use cases that could
> cause artifacts (e.g. applying transforms post rasterization) Even with
> this feature, it still requires a lot of care to do everything right 100%
> of the time.  For example, suppose the page gets zoomed after the canvas
> contents were rendered.
> Advanced authors will be able to deal with this by triggering a canvas
> re-draw, they might even preserve subpixel AA by resizing the canvas and
> applying a reciprocal scale to bring the canvas element's effective zoom
> back to 1.
> Given how 2d canvas currently works, I don't see any killer solution that
> would allow subpixel antialiased text without any caveats.
> Are there precedents for exposing features with documented caveats?
> (excluding caveats that were discovered after the fact)
> Anyone with brilliant ideas: please speak up!
> Thanks,
>     -Justin
> > Rob
> > --
> > Jesus called them together and said, “You know that the rulers of the
> > Gentiles lord it over them, and their high officials exercise authority
> > over them. Not so with you. Instead, whoever wants to become great among
> > you must be your servant, and whoever wants to be first must be your
> > slave — just as the Son of Man did not come to be served, but to serve,
> > and to give his life as a ransom for many.” [Matthew 20:25-28]
> >
> >

More information about the whatwg mailing list