[cairo] Sub-pixel Font Filtering in 1.10

Lance Hepler nlhepler at gmail.com
Fri Jan 15 09:05:20 PST 2010

Hi again, Freddie,

> > Aside from the bad names, one of the primary justifications I've seen
> > for changing the filtering is to render fonts with horrible hinting
> > instructions (or systems with horrible hinting implementations) with
> > less color-fringing. Personally, I see sub-pixel rendering as something
> > that doesn't even make sense to do unless you've got a well-behaving
> > system, (both font and hinting engine), in the first place.
> >
> > So fixing up "bad" color fringing in a case like this is really just a
> > band-aid for an entirely different problem. The better way to avoid
> > color fringing in such a case is to just not use sub-pixel rendering,
> > (or fix the broken font or hinting implementation).
> It is not a band-aid at all. Cairo currently uses an intra-pixel filter taken
> from libXft. This filter is *technically inferior* to finite impulse response
> filter (FIR) which is used by: CoreText (OS X), ClearType (Windows), Qt (pre
> 4.5) and FreeType (post 2.3 as an option). The FIR type filters are inter-pixel
> filters (so the filtering is performed across sub-pixel boundaries --- just as
> it should be).
> The hinting argument is also heavily flawed; it is hinting itself that is a
> band-aid --- a hack from a time when anti-aliasing was not practical. The
> effect of hinting is to distort the outlines of glyphs --- and hence it *can
> not* be used when rendering freely scalable text, such as that in a PDF
> document. So if you want your system to be able to render PDF documents with
> sub-pixel rendering you need an FIR-type filter.
> If one looks at a PDF document in Evince (and it has to be Evince, not Okular
> due to the way Poppler works) you're looking at un-hinted text rendered by
> Cairo. However, you'll also notice a lack of sub-pixel rendering (even if it
> is enabled for the rest of the system). One reason for this is because the
> default Cairo filter would awful colour fringes.
> All modern operating systems are moving away from hinting, as of 2010. Apple
> ditched it back in 2001 with the release of OS X, Microsoft second with the
> release of the WPF (.NET, all text is freely scalable) and most recently with
> the release of DirectWrite. Hinting is, for all practical purposes, a dead
> end.
> I discuss these hinting- and implementation-related issues at length in my
> article on font rasterisation:
>  http://freddie.witherden.org/pages/font-rasterisation/>

Oh thank GOODNESS, some strong objective arguments in favor of modern
SPR. We desperately need these almost as much as we need a technical
solution to this debacle.

> Personally, I am not convinced there is a need to directly configure the sub-
> pixel filter. (Unlike say with hinting and anti-aliasing where a sound
> technical case can be made for changing these --- such as when requiring
> freely scalable text.) Just respect Fontconfig and everyone wins.

I agree, however in this instance, any of the more recent cairo-SPR
patches proposed thus far respect fontconfig. IMHO, the only piece of
software that does not respect fontconfig settings is freetype, which
silently disables its SPR.


More information about the cairo mailing list