Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 578122

Summary: x11-libs/cairo - add patch make LCD_FILTER_DEFAULT the actual default
Product: Gentoo Linux Reporter: cristiano04
Component: Current packagesAssignee: Alexandre Rostovtsev (RETIRED) <tetromino>
Status: RESOLVED UPSTREAM    
Severity: normal CC: Adrian.Bassett, tetromino, x11, yngwin
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Makes LCD_FILTER_DEFAULT the actual default
ebuild
cairo-1.14.6.ebuild
cairo-1.14.4.ebuild
cairo-1.14.2-r1.ebuild
cairo-1.14.2.ebuild
cairo-lcdfilter-make-default-default.patch

Description cristiano04 2016-03-23 18:55:21 UTC
Forcing LCD filtering in the Cairo backend by setting cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL); inexplicably enables the gruesome LCD_FILTER_LEGACY algorithm.

This patch corrects this silly behaviour and considerably improves font rendering.

P.S.: Adding an extra fontconfig-ultimate USE flag that applies the patch available in https://github.com/bohoomil/fontconfig-ultimate/tree/master/cairo wouldn't hurt either.

Reproducible: Always




First picture: poppler + cairo-qt backend to enable subpixel rendering. Terrible fringes because it defaults to the legacy filter.
Second picture: poppler + cairo-qt backend + cairo with this patch. Proper LCD filter, no fringes.

http://screenshotcomparison.com/comparison/166497
Comment 1 cristiano04 2016-03-23 18:56:43 UTC
Created attachment 428850 [details, diff]
Makes LCD_FILTER_DEFAULT the actual default
Comment 2 cristiano04 2016-03-23 18:57:03 UTC
Created attachment 428852 [details]
ebuild
Comment 3 cristiano04 2016-03-23 18:57:57 UTC
Created attachment 428854 [details]
cairo-1.14.6.ebuild
Comment 4 cristiano04 2016-03-23 18:58:31 UTC
Created attachment 428856 [details]
cairo-1.14.4.ebuild
Comment 5 cristiano04 2016-03-23 18:58:57 UTC
Created attachment 428858 [details]
cairo-1.14.2-r1.ebuild
Comment 6 cristiano04 2016-03-23 18:59:13 UTC
Created attachment 428860 [details]
cairo-1.14.2.ebuild
Comment 7 cristiano04 2016-03-23 18:59:45 UTC
Created attachment 428862 [details, diff]
cairo-lcdfilter-make-default-default.patch

Makes LCD_FILTER_DEFAULT the actual default
Comment 8 cristiano04 2016-11-06 18:19:54 UTC
This is still relevant. I have just successfully applied the patch to cairo-git. There are literally no downsides to applying this patch.
Comment 9 cristiano04 2016-11-06 18:21:55 UTC
(In reply to cristiano04 from comment #8)
> This is still relevant. I have just successfully applied the patch to
> cairo-git. There are literally no downsides to applying this patch.

Rationale for this patch can be found here: https://bugs.freedesktop.org/show_bug.cgi?id=10301#c95
Comment 10 Matt Turner gentoo-dev 2016-11-06 20:15:17 UTC
(In reply to cristiano04 from comment #8)
> This is still relevant. I have just successfully applied the patch to
> cairo-git. There are literally no downsides to applying this patch.

If there are "literally no downsides" then please have the patch applied upstream.

Patching live ebuilds is a mess. epatch_user works though. Feel free to do that. See https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_epatch_user
Comment 11 cristiano04 2016-11-07 02:58:48 UTC
(In reply to Matt Turner from comment #10)
> (In reply to cristiano04 from comment #8)
> > This is still relevant. I have just successfully applied the patch to
> > cairo-git. There are literally no downsides to applying this patch.
> 
> If there are "literally no downsides" then please have the patch applied
> upstream.
> 
> Patching live ebuilds is a mess. epatch_user works though. Feel free to do
> that. See
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/
> Advanced#Using_epatch_user

Did you not read the issue linked in comment 9? Besides, you could hide it behind a USE flag. The only thing this patch does is replace LCD_FILTER_LEGACY, which should never be used under any circumstances, with LCD_FILTER_DEFAULT. It's not removed, simply no longer the default LCD filter.
Current Cairo, as used by poppler's qt backend, will default to FT_LCD_FILTER_LEGACY, since they removed cairo_font_options_set_lcd_filter(), which in turn results in hideous colour fringes.

I am aware I can patch it myself with epatch, since that's precisely what I did when I submitted the fixed ebuilds.

Here's an example of what I'm talking about, look at the i's and the l's, and then compare them: http://screenshotcomparison.com/comparison/166497
The original post explains it perfectly.

As for making them merge it upstream, it wouldn't fix previous ebuilds, and they ignore the bug tracker.
Comment 12 Matt Turner gentoo-dev 2017-01-29 07:08:05 UTC
(In reply to cristiano04 from comment #11)
> As for making them merge it upstream, it wouldn't fix previous ebuilds, and
> they ignore the bug tracker.

Use the mailing list.