Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#35274 - [freetype2] 2.4.11: Enable Subpixel Hinting

Attached to Project: Arch Linux
Opened by Jan Alexander Steffens (heftig) - Tuesday, 14 May 2013, 13:02 GMT
Last edited by Jan Alexander Steffens (heftig) - Monday, 29 December 2014, 01:15 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Andreas Radke (AndyRTR)
Jan Alexander Steffens (heftig)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

I would like to suggest enabling the new Subpixel Hinting feature of freetype2, which alters TrueType hinting behavior to be more like Microsoft Windows.

This dramatically improves rendering of late Microsoft-supplied fonts (such as Consolas and Segoe UI), but does not leave other TrueType fonts untouched. In some cases, rendering is subjectively worse.

Still, I believe it's an overall win for rendering quality and worth enabling by default.

This would revert https://bugs.archlinux.org/task/33148 .

Patch:
http://pkgbuild.com/~heftig/packages/freetype2-git/freetype-2.4.11-enable-sph.patch

Before:
http://pkgbuild.com/~heftig/screenshots/without-spr-segoe.png
http://pkgbuild.com/~heftig/screenshots/without-spr-consolas.png
http://pkgbuild.com/~heftig/screenshots/without-spr-dejavu.png
http://pkgbuild.com/~heftig/screenshots/without-spr-arimo.png

After:
http://pkgbuild.com/~heftig/screenshots/with-spr-segoe.png
http://pkgbuild.com/~heftig/screenshots/with-spr-consolas.png
http://pkgbuild.com/~heftig/screenshots/with-spr-dejavu.png
http://pkgbuild.com/~heftig/screenshots/with-spr-arimo.png
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Monday, 29 December 2014, 01:15 GMT
Reason for closing:  Implemented
Additional comments about closing:  Available (but not enabled by default).
Comment by Jan de Groot (JGC) - Tuesday, 14 May 2013, 21:38 GMT
Looking at your examples, and specifically the one with Dejavu, did you notice that font width changes a lot between spr or no spr? It's not about just a few pixels, it's a huge increase in size compared to the tiny font size that it happens with.
Comment by Jan Alexander Steffens (heftig) - Tuesday, 14 May 2013, 22:17 GMT
The line with the extreme width change in DejaVu (the second line) has a font size of 7.5pt (@96ppi).

The unhinted text has a width about half between the two renderings.
Comment by Andreas Radke (AndyRTR) - Saturday, 18 May 2013, 10:36 GMT
I'm for staying plain vanilla unpatched here as always in Arch.
Comment by Daniel Micay (thestinger) - Saturday, 18 May 2013, 10:54 GMT
This isn't about patched vs. unpatched, it's an upstream compile-time option exposed as a preprocessor flag just like subpixel support itself.
Comment by Jan Alexander Steffens (heftig) - Friday, 21 November 2014, 11:25 GMT
Seems the screenshots I made are outdated; the behavior changed again. alucryd did a new series of comparisons at http://pkgbuild.com/~alucryd/freetype/ . 1 is without SPH, 2 is with SPH. The few images having a 3 are from freetype2-infinality.

I've also written a patch that allows getting the old behavior back by setting the environment variable "FT2_NO_SUBPIXEL_HINTING", see http://pkgbuild.com/~heftig/packages/freetype2-git/env_FT2_NO_SUBPIXEL_HINTING.diff .
Comment by Jan Alexander Steffens (heftig) - Sunday, 23 November 2014, 21:43 GMT
I didn't expect too much, but the env patch was rejected upstream. The application is supposed to select the interpreter version.

I suppose this means for a proper solution, at least fontconfig and perhaps other parts of the stack will have to learn how to set the version.

Should I leave the patch in for now? I haven't pushed anything yet as I wanted to wait for feedback.
Comment by Daniel Micay (thestinger) - Monday, 24 November 2014, 03:44 GMT
Could this be done via a fontconfig tunable rather than an environment variable?
Comment by Jan Alexander Steffens (heftig) - Sunday, 30 November 2014, 17:25 GMT
Any objections to applying the getenv patch? It'll be something that never goes upstream.

@thestinger: That it how it *should* work, but I don't have time to dive into fontconfig.
Comment by Evangelos Foutras (foutrelis) - Monday, 08 December 2014, 02:41 GMT
We should stick to the default behavior and keep the package as vanilla as possible; so -1 for the getenv patch.

SPH also makes some fonts render slightly fuzzy (e.g. DejaVu Sans). Making a pretty common Linux font like that render worse so that e.g. Segoe UI doesn't appear fuzzy doesn't seem like a good trade-off to me.
Comment by Ciriaco Garcia de Celis (cgarcia) - Sunday, 28 December 2014, 21:23 GMT
Even setting FT2_SUBPIXEL_HINTING=0 many fonts (e.g. Monospace used in text editors) are no longer fine rendered. I agree that old MS fonts may have problems, but... standard linux fonts also?. Setting sub-pixel-order to NONE in XFCE improves things (e.g. no color artifacts) but doesn't restores the better previous appeareance (e.g. the "l" and "d" have different vertical thickness). I have reverted (at least by the moment) to the previous freetype-2.5.3-2 package.
Comment by Mantas Mikul─Śnas (grawity) - Sunday, 28 December 2014, 21:51 GMT
cgarcia, note that the patch checks for *presence* of the envvar, not the value. You need to completely unset it.
Comment by Ciriaco Garcia de Celis (cgarcia) - Sunday, 28 December 2014, 22:00 GMT
A few days ago I upgraded and manually set FT2_SUBPIXEL_HINTING to 1 thinking that I have used that feature for the last years and want to continue using it (at least XFCE has settings for hinting and subpixel order and they change the fonts appearance). In the poor laptop screen (I was out of home) I didn't pay much attention to the bad fonts.

Now at home with in my desktop LCD, after identifiying freetype2 as the "culprit" package of the poor fonts rendering, I set the environment variable to 0 (even I didn't remembered to have set it to 1 a few days ago) and this doesn't disables hinting... fortunately, by looking at the source code of the patch, I see that it only tests for the variable presence. You have to NOT SET the variable at all.

I think that it may be a bit misleading that FT2_SUBPIXEL_HINTING=0 also *ENABLES* subpixel hinting.
Comment by Ciriaco Garcia de Celis (cgarcia) - Sunday, 28 December 2014, 22:01 GMT
Thanks grawity, I just have figured it. Now all is OK again with the latest package.

Loading...