I found two weird issues with font rendering that makes it ugly. First of all the antialiasing method seems to differ when the cairo source is a solid color or a pattern. Subpixel smoothing is only used with a solid color source. The other problem happens when a black bg is used, the subpixel smoothing make the font look bold instead of normal.
Created attachment 24325 [details] Test case
Created attachment 24326 [details] Test case output
I looked at this before noticing that the bug report was for quartz.... That said, I can confirm that the lack of sub-pixel aa when using a pattern does not occur when the test case is compiled with -DNOT_QUARTZ against a version of cairo which uses freetype. (I was going to write “it is quartz-specific” but other backends (such as dows) may have similar issues.... As for the gamma issue, zooming in on the image shows that the pixel coverage is the same in the w/b half as in the b/w half. A similar bug report was made against libXft some years ago; the sub-pixel filtering has to take gamma into consideration in order for the font weight to look similar when rendered to different colour combinations.
Created attachment 24826 [details] html example ok, so this is not a cairo bug but a quartz one, even tough it would be really nice to find a workaround. Quartz docs say that in some situations, like when drawing over a bitmap subpixel smoothing is not recommended. So after reading that, i read around the web that you should set and draw the bg before setting up font smoothing, and that if you do not know the bg color you better dont use subpixel AA. First I though it makes sense, but then I wondered if safari knew its bg color and as far i can tell, it does not.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/291.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.