[whatwg] Enabling LCD Text and antialiasing in canvas
gman at google.com
Sun Mar 17 20:17:47 PDT 2013
On Sun, Mar 17, 2013 at 1:40 PM, Robert O'Callahan <robert at ocallahan.org>wrote:
> On Sat, Mar 16, 2013 at 5:52 PM, Gregg Tavares <gman at google.com> wrote:
>> Let me ask again in a different way ;-) Specifically about LCD style
>> What about a context attribute "antialiasRenderingQualityHint" for now
>> 2 settings "default" and "displayDependent"
>> context.antialiasRenderingQualityHint = "displayDependent"
> How would this interact with canvas opacity? E.g. if the author uses
> displayDependent and then draws text over transparent pixels in the canvas,
> what is the UA supposed to do?
Whatever the UA wants. It's a hint. From my POV, since the spec doesn't say
anything about anti-aliasing then it really doesn't matter.
My preference, if I was programming a UA, would be if the user sets
"displayDependent" and the UA is running on a lo-dpi machine I'd
unconditionally render LCD-AA with the assumption that the canvas is
composited on white. If they want some other color they'd fill the canvas
with as solid color first. Personally I don't think that needs to be
specced, but it would be my suggestion. As I mentioned, even without this
hint the spec doesn't prevent a UA from unconditionally using LCD-AA.
Very few developers are going to run into issues. Most developers that use
canvas aren't going to set the hint. Most developers that use canvas dont'
make it transparent nor do they CSS rotate/scale them. For those few
developers that do happen to blend and/or rotate/scale AND set the hint
they'll get probably get some fringing but there (a) there was no guarantee
they wouldn't already have that problem since as pointed out, the spec
doesn't specify AA nor what kind, and (b) if they care they'll either stop
using the hint or they'll search for "why is my canvas fringy" and the
answer will pop up on stackoverlow and they can choose one of the solutions.
> Wrfhf pnyyrq gurz gbtrgure naq fnvq, “Lbh xabj gung gur ehyref bs gur
> Tragvyrf ybeq vg bire gurz, naq gurve uvtu bssvpvnyf rkrepvfr nhgubevgl
> bire gurz. Abg fb jvgu lbh. Vafgrnq, jubrire jnagf gb orpbzr terng nzbat
> lbh zhfg or lbhe freinag, naq jubrire jnagf gb or svefg zhfg or lbhe fynir
> — whfg nf gur Fba bs Zna qvq abg pbzr gb or freirq, ohg gb freir, naq gb
> tvir uvf yvsr nf n enafbz sbe znal.” [Znggurj 20:25-28]
More information about the whatwg