W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Enabling LCD Text in 2D canvases.

From: Justin Novosad <junov@chromium.org>
Date: Wed, 14 Nov 2012 11:09:49 -0500
Message-ID: <CABpaAqTens8M2nFia=+mKCZnNayjy-jDtObTt3m5_F25AydVCg@mail.gmail.com>
To: robert@ocallahan.org
Cc: whatwg <whatwg@lists.whatwg.org>
On Tue, Nov 13, 2012 at 9:37 PM, Robert O'Callahan <robert@ocallahan.org>wrote:

> On Mon, Nov 12, 2012 at 2:36 PM, Justin Novosad <junov@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]
>
>
Received on Wednesday, 14 November 2012 16:16:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT