It looks like the culprit is in cairo-win32-font.c, judging from these comments (line 1186):
"* Otherwise, we need to draw using software fallbacks. We create a mask
* surface by drawing the the glyphs onto a DIB, black-on-white then
* inverting. GDI outputs gamma-corrected images so inverted black-on-white
* is very different from white-on-black. We favor the more common
* case where the final output is dark-on-light."
After that (at line 1212):
"* For ClearType, we need a 4-channel mask. If we are compositing on
* a surface with alpha, we need to compute the alpha channel of
* the mask (we just copy the green channel). But for a destination
* surface without alpha the alpha channel of the mask is ignored"
(Let's not forget that our surface is semi-transparent, so it does have an alpha!)
And a few lines later (line 1225):
"* XXX: Hacky, should expose this in cairo_image_surface"
Probably this is a bug in Cairo itself, but it seems to need quite a major rewrite.
It looks like the culprit is in cairo-win32-font.c, judging from these comments (line 1186):
"* Otherwise, we need to draw using software fallbacks. We create a mask
* surface by drawing the the glyphs onto a DIB, black-on-white then
* inverting. GDI outputs gamma-corrected images so inverted black-on-white
* is very different from white-on-black. We favor the more common
* case where the final output is dark-on-light."
After that (at line 1212):
"* For ClearType, we need a 4-channel mask. If we are compositing on
* a surface with alpha, we need to compute the alpha channel of
* the mask (we just copy the green channel). But for a destination
* surface without alpha the alpha channel of the mask is ignored"
(Let's not forget that our surface is semi-transparent, so it does have an alpha!)
And a few lines later (line 1225):
"* XXX: Hacky, should expose this in cairo_image_ surface"
Probably this is a bug in Cairo itself, but it seems to need quite a major rewrite.