Closed Bug 614887 Opened 12 years ago Closed 12 years ago
Use grayscale-AA fonts for text in canvas
Currently when we draw to a canvas, we use default antialiasing (which often means supbixel-AA). Since canvases can have transparent content in general, this means things can go rather wrong (see bug 363861). In bug 363861 we improve the situation a bit by disabling subpixel-AA rendering for transparent surfaces (including canvas surfaces) by default. But that still leaves us in a suboptimal situation where text metrics and glyph placement use the subpixel-AA font but the glyphs are rendered either using a grayscale-AA font or by converting the subpixel alpha mask to an A8 mask. Instead we should just always disable subpixel-AA when we create the fonts in nsCanvasRenderingContext2D. (Or we could support component alpha for canvas layers, but I really don't want to go there.) We can't just set the font antialiasing option to CAIRO_ANTIALIAS_GRAY since some users might have antialiasing completely disabled. I think probably the best thing to do would be to get the canvas surface font options; if the surface default antialiasing mode is not NONE, pass GRAY when we create the font, otherwise pass NONE. This means a) we have to add an antialiasing mode to nsFont and gfxFontStyle, b) we have to forward that mode in the gfx*FontList implementations that create a scaled_font, and c) we have to actually implement the get_font_options surface callback for Win32-GDI and maybe Quartz.
Will this be affected by bug 622482?
This was actually fixed by bug 363861.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.