When drawing to RGBA surfaces, we often want to disable subpixel antialiasing and use grayscale antialiasing instead, because however one crams three mask alpha values into a single destination alpha value, the results are often bad.<br>
<br>Using cairo_font_options_set_antialias to disable subpixel antialiasing is problematic. There is no way to request &quot;the default, unless it&#39;s subpixel, in which case grayscale&quot;. More importantly, it&#39;s difficult (in our application at least) to route information about the target surface to all the places where we might create fonts, where we&#39;d need to call cairo_font_options_set_antialias with the right options. This is especially tricky because we cache fonts, so drawing the same objects to different surfaces could require us to destroy and recreate fonts just to switch their antialiasing mode.<br>
<br>A much simpler and more elegant solution is to add a new cairo surface API that lets us disable subpixel antialiasing for all rendering to a given surface, and let the surface backend text rendering code be responsible for disabling subpixel antialiasing. This can be implemented with a very small amount of code. To preserve cairo API compatibility, subpixel antialiasing must be enabled by default (even for RGBA surfaces).<br>
<br>The attached patch (not properly formatted for the cairo git repository, sorry) implements proposed new APIs cairo_surface_set_subpixel_antialiasing and cairo_surface_get_subpixel_antialiasing. Comments welcome.<br><br>
Thanks,<br>Rob<br>-- <br>&quot;Now the Bereans were of more noble character than the 
Thessalonians, for they received the message with great eagerness and 
examined the Scriptures every day to see if what Paul said was true.&quot; [Acts 17:11]<br>