[Development] Font rendering on X11/Wayland: New FreeType API to toggle LCD filters and stem darkening on a per-font basis, would love a review

Nikolaus Waxweiler madigens at gmail.com
Thu Nov 17 23:53:50 CET 2016


Hi!
people in #qt-labs directed me here.

I'm working on FreeType and want to merge a new API (FT_Face_Option)
that would allow setting LCD filter weights and stem darkening
properties on a per-face basis. The goal is to enable toolkits like Qt
to finally turn on linear alpha blending and gamma correction on
X11/Wayland for font rendering without users filing bugs like
https://bugreports.qt.io/browse/QTBUG-41590. Stem darkening thickens
glyphs depending on pixel size and the font design itself to prevent
them from thinning out with LAB+GC. This would properly solve the
above bug.

A side issue this is trying to solve is making the API thread-safer,
i.e. threads can now toggle stem darkening and modify LCD filter weights
directly on their own FT_Face object without contending for a shared
FT_Library or the font-driver-wide setting.

I'd love to get feedback on the API before we make it official because I
want to make sure it's actually useful in practice.

The patches for FT are the top 3 commits at
https://github.com/madig/freetype2/commits/stem-darkening-api. You can
clone the repo somewhere and modify your compiler's include directives
to look for FreeType there, then load the new library with
`LD_PRELOAD=/somewhere/freetype2/objs/.libs/libfreetype.so
some-application`.

API usage examples are at
https://github.com/madig/freetype2/commit/297b68621c020c8d6e61a04b8e91ac829a6bc13d#diff-9a8d509c02006aa497c68bcbcd32d505R3618

Best regards,
Nikolaus



More information about the Development mailing list