[Development] about the Cocoa/Freetype fontengine

René J. V. Bertin rjvbertin at gmail.com
Sat Dec 30 10:57:10 CET 2017


Nikolaus Waxweiler wrote:


> I don't get it. How will this improve the look of Qt-Mac applications?

This is in the eye of the beholder, to some extent. Ideally you will hardly 
notice a difference as a casual user.

> Apps using CoreText will look different than Qt apps linking to a
> patched FreeType and FontConfig. It is unlikely that these patches will
> ship in official builds (they're not mainlined for a reason), so it
> would only be your custom compiled applications. The difference would be
> jarring.

Well, that's up to the application developer to decide, no? Qt evolves in a 
universe where it's considered normal to ship copies of the required libraries 
with(in) each and every application. That includes the FreeType library if that 
font engine is to be supported, and the FontConfig library could be included just 
as easily. With or without patches. 

The Infinality patches aren't mainlined (what's left of them) for 2 reasons that 
I'm aware of. The FT developers are overly cautious about possible licensing 
issues and claim there are performance implications. I can only comment from 
personal experience and expertise on the latter: humbug.

> Aside: The Infinality patches make fonts look good only under very
> specific circumstances and inevitably lead to jarring differences when
> some font next to the "good" ones doesn't fit the specifics. I wasted a
> lot of time on that patch set when I was young.

Is that longer than about 6 years ago? I've been using the patch set for that 
long, with the accompanying FC and Cairo patches of course, and the only specific 
circumstance where I had jagged (pun intended) fonts was when an application 
shipped its own FreeType (wine!) or I tried a new distro. Plus possibly a very 
rare occasion where the patch maintainer slipped up.

OTOH I get frequent requests to upgrade my Trusty PPA with the patched FT, FC 
and Cairo libraries, and if you look at the number of forks around and the 
activity around the various packaging implementation you'll realise that there 
are a lot of people who care and consider the gain in quality is significant 
enough to mess around with system libraries. That's certainly not for nothing.


> The entire patch is
> tailored to a platform that never rendered fonts correctly.

Shall we say optimally and make it dependent on point size?

> The fuzziness FT > CoreText > FT X11 is because on X11, some form of
> hinting is usually turned on and there is no linear alpha blending plus
> gamma correction, leading to harsher rendering that only appears less
> fuzzy. 

That's the whole trick, isn't it? Exploiting specifics of human vision so things 
look sharp while in reality they aren't and even if they were we wouldn't 
perceive them as such (read up on how fresco painters from the Renaissance 
worked around that, for fun :))

> CoreText ignores hints but darkens stems (overly so by default)
> to counter the effects of gamma correction, FT will only do that when
> told so.

Which only means that both platforms have there own suboptimal way of doing 
things. Font developers provide hinting for a reason and spend inordinate 
amounts of time getting it right. Ignoring it is just stupid, at least on 
devices with traditional and affordable display densities.

> You probably shouldn't enable stem darkening when using the Infinality
> set or turn off hacks for CFF fonts until there are no more issues.

I probably would if I knew how. In practice I've only come across a single font 
family where the difference is notable and the font gamma value has an effect. 
That parameter is apparently ignored for all other fonts so the easy solution 
for me is to tune that value and be done with it.

R





More information about the Development mailing list