Setting FREETYPE_PROPERTIES

Hi,

as far as I’m aware (correct me if I’m wrong) Haiku uses AGG for drawing which in turn uses FreeType to render text. In recent versions of FreeType it’s possible to enable “stem darkening” by setting a environment variable which is picked up by the FreeType library when initialized.

I would love to tweak these parameters on Haiku too, is there a way of achieving this?

The environment variable in question is “FREETYPE_PROPERTIES”, under Linux I always put the following line in /etc/environment to enable stem darkening:

FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"

With kind regards,
Egon

You’re not mistaken. I’m not sure the version we use for Haiku supports this already, but all drawing is done by the app_server which is started by the launch_daemon. I’m not sure if it’s possible to add env variables to this process without changing its launch script, but there should be a SetupEnvironment script that may be usable for this.

Hi Axel, thank you for your reply and pointing me to the SetupEnvironment script - setting up the “global” environment this way works, unfortunately it makes no difference in rendering when setting the FREETYPE_PROPERTIES that way. Anyways, as it may be of interest for other users who want to set up “global” environment variables:

Just put the variable export to /boot/home/config/settings/boot/UserSetupEnvironment:

export FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"

This way, the environment variable is set up by the launch_daemon as soon as it’s launched and prior to any other services.

2 Likes

maybe file a issue to add this to the appearence preferences? instead of env variables

We usually try to keep these options low, especially if it’s only minor render differences.

I am wondering though if one font is better rendered with or without this option if we can add the info to the font file which way it should render.

When rendering via Harfbuzz will be implemented perhaps this will make a more noticeable difference for some languages. In this case, it may be interesting to tied it to locales chosen.

For the interested one, here is the corresponding FreeType documentation entry:

In general, stem darkening looks better in almost all cases. Slowly, Linux distributions (at least the ones who claim to be “beautiful”; Elementary OS) start adopting stem darkening as their default configuration. Also Mac OS’s font renderer does stem darkening for a few years now - don’t remember exactly at which point, but it was at the same time when they disabled subpixel rendering.

However, there’s a drawback. Some people with specific eye problems (astigmatism) don’t like to look at fonts rendered that way. It’s a common complain on Reddit and the Apple forums. So in my opinion it should be made configurable if it is implemented.