[cairo] Struggling with subpixel text (last blocker for 1.8)

Sylvain Pasche sylvain.pasche at gmail.com
Sat Sep 27 09:22:57 PDT 2008


Hi Carl,

That's definitely a regression if Cairo is using a FreeType not compiled 
with subpixel rendering [1]. There are other options in FreeType that 
can be selected at compile time such as enabling the bytecode 
interpreter or not. I noticed that it is usually all or nothing for 
distributions: either they enable lcd filtering and the bytecode 
interpreter (Debian/Ubuntu), or they do not enable anything 
(Redhat/Fedora). Using the old lcd filtering algorithm in Cairo without 
having the bytecode interpreter enabled can lead to unpleasant looking 
fonts for users [2]. So in most situations, the regression will be 
between a "not best looking lcd filtering" and no filtering at all. I 
don't mean that the regression is not an issue, just that it may not be 
as bad as it seems.

The test assumed that FreeType was compiled with that option. Ideally, 
it should have used two reference images, and switch the image to test 
according to the HAVE_FT_LIBRARY_SETLCDFILTER macro value. I'm not sure 
this is possible to do with the current test infrastructure.

Do you still think we should incorporate the old filter algorithm in 
case HAVE_FT_LIBRARY_SETLCDFILTER is undefined? In my opinion, this 
should belong in FreeType. It is a bit ironic that distributions do not 
compile FreeType with lcd filtering because of patent issues while the 
same thing is available inside Cairo without a way to turn it off. Last 
time I tried OpenSuse, subpixel antialiasing was not available by 
default because they compiled Cairo with the subpixel patch and didn't 
compile FreeType with the lcd filtering option.


Sylvain

[1] http://bugs.freedesktop.org/show_bug.cgi?id=10301#c34
[2] http://lists.cairographics.org/archives/cairo/2008-January/012685.html


Carl Worth wrote:
> So I stayed up all night trying to get the 1.8 release done.
> 
> The test suite was in pretty bad shape as of the last 1.7.6 snapshot.
> There were dozens of failing tests, and the causes were all over the
> place:
> 
> * Stale reference images needing to be updated
> 
> * Known bugs that needed to be marked as XFAIL
> 
> * New regressions that needed to be fixed
> 
> It was pretty tedious work sorting through all that, and for the ones
> that were actual regressions we had to actually fix the bugs too. Thanks
> to Behdad, Chris, Emmanuel, and Adrian for helping out with that
> process.
> 
> The final result I got to was a single test not passing, (I
> intentionally wasn't testing xlib to avoid X server/driver issues):
> 
> 	text-antialias-subixel
> 
> And this one is a regression. It's giving me grayscale antialiasing
> instead of subpixel on image and other backends. The text passes fine
> back in 1.6.4.
> 
> I bisected the failure down to this large commit:
> 
>   commit 7f870035177da7aa63fa33dce837528f442d9ffe
>   Author: Sylvain Pasche <sylvain.pasche at gmail.com>
>   Date:   Tue Jan 22 23:51:32 2008 +0100
> 
>     [cairo-ft] LCD filtering patch from David Turner
>     
>     This is the patch David Turner wrote some times ago and can be found on
>     http://david.freetype.org/lcd/cairo-1.2.4-lcd-filter-1.patch. It was
>     somewhat modified for compatibility with cairo 1.5
> 
> I spent a fair amount of time trying to debug this, but never succeeded.
> So now I'd like some suggestions on how to proceed. One option is to
> revert the patch, (it broke an existing test in the test suite after
> all). I've got a patch in my personal repository, (revert-lcd-filter
> branch), that does this and which seems to work:
> 
>     http://cgit.freedesktop.org/~cworth/cairo/log/?h=revert-lcd-filter
> 
> But meanwhile, I know that some users were particularly keen on being
> able to control, (via fontconfig), the various LCD filter options made
> available by freetype. And reverting this patch would remove that
> possibility.
> 
> Behdad, do you have some guidance here? Can you fix the code so that the
> test suite works? Or shall we just go ahead with the revert and bring
> back the LCD filter functionality in 1.8.2 or so? I know you were hoping
> to wake up and see that the release had already happened. Sorry that
> didn't happen, but this is really the last issue left.
> 
> -Carl (overdue for sleep)



More information about the cairo mailing list