BGR subpixel rendering is broken in 1.10.2, it always results in an image identical to RGB subpixel rendering. The problem can be produced with code like this: cairo_font_options_t* fopts = cairo_font_options_create(); cairo_font_options_set_subpixel_order(fopts, CAIRO_SUBPIXEL_ORDER_BGR); cairo_font_options_set_antialias(fopts, CAIRO_ANTIALIAS_SUBPIXEL); cairo_set_font_options(cr, fopts); Which will produce the same output as with CAIRO_SUBPIXEL_ORDER_RGB. The problem is caused by a missing 'break' statement in a 'switch' in src/cairo-ft-font.c. Patch for the issue is attached.
Created attachment 50673 [details] [review] Add the missing break; Ingo Ruhnke's patch.
I'll confirm the proposed fix -- I'm the original reporter on Ubuntu Bug 703191 (link available under "See Also"), and I have manually patched and built Cairo 1.10.2 on my system using Ingo Ruhnke's patch. BGR-ordered subpixel font rendering now looks fine systemwide, and switching back and forth between RGB and BGR has the expected effect. Can we get some developer eyes on this? It's a year-old regression and it would be nice to kill it off once and for all.
The new test text-antialias-subpixel-bgr from commit 9208df1630a53 shows this exact problem. The proposed fix from comment 1 works there, too. Could someone who dares touching font stuff take a closer look?
commit 7df2c113b16666d4b1f3e4c6f4cb045c40929c4f Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Thu Oct 13 13:02:51 2011 +0100 ft: Add missing break to enable BGR subpixel rendering Reported-by: Ingo Ruhnke <grumbel@gmx.de> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40456 Original-patch-by: Simon Elmir <nerd65536+freedesktop@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> commit 9208df1630a535d473f656575c61a0ccf0c2a89c Author: Uli Schlachter <psychon@znc.in> Date: Thu Oct 13 12:46:03 2011 +0200 test: Add text-antialias-subpixel-{,v}{bgr,rgb} There were no tests for any subpixel order but rgb, so let's write something all four possibilities. This is mostly copy&paste from test/text-antialias.c (and text-antialias-subpixel-rgb does the same thing as text-antialias-subpixel)
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.