elementary / default-settings

Default settings for elementary OS
GNU General Public License v3.0
39 stars 28 forks source link

Stem Darkening enabled by default #266

Open AchillesBoi opened 2 years ago

AchillesBoi commented 2 years ago

Problem

The default Inter font is blurry and slightly harder to read compared to other fonts (Noto Sans and Ubuntu come to mind).

Proposal

Enable stem darkening system-wide by adding this line at the end of the "environment" file located in /etc:

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

Stem darkening effectively makes small and thin lines from a font slightly bolder for easier readability and better contrast. This is something that macOS already does and I think it fits nicely with how elementaryOS presents itself, making for a cleaner UI.

Prior Art (Optional)

I learned about this when using KDE and noticing how much better fonts look compared to GNOME. The KDE devs enabled stem darkening on a DE level so while every QT app takes advantage of this, it seems GNOME apps do not. In order to get some consistency between QT and GNOME apps one would have to enable stem darkening at a system level, which is what that line of code does.

I also noticed that the font kerning in QT apps is much better than GNOME. Again, this is something purposefully implemented by the KDE devs at a DE level but I have not been able to replicate it at a system level. In other words, I have yet to find the line (or lines) of code necessary to enable this. If one could figure out exactly what sort of black magic the KDE devs used to improve font rendering and bring that same quality to elementaryOS, that would improve things a lot.

Use Evince and Okular on the same document and compare their respective font renderings to understand what I'm talking about.

TeamPuzel commented 1 year ago

Hey, I would like to add something I mentioned yesterday, this is not as simple as just changing a setting, because what you're describing makes fonts look worse on a HiDPi display; techniques like hinting or the stem darkening were designed a long time ago when displays were low resolution and couldn't handle thin lines.

macOS rendering rant 👀

macOS is rendering text incorrectly and comparing side by side on 2 MacBooks disabling the setting makes text sharper, since they have HiDPi displays. You can test it by manually changing the .plist using the userdefaults command, since they removed the checkbox. Remember that at some point, for 2560x1600 MacBooks the default scaling was made incorrect and not actually divisible by display resolution, so font smoothing will look better since pixels are uneven 😤; make sure the scaled resolution is 800 vertically and not 900, even though macOS tells you it's a "scaled" resolution. it's not, it's just compensating for Big Sur increasing padding everywhere.

Only then you can accurately test the effect of font smoothing, otherwise the entire display is blurry anyway 😐

Advanced solution

I think the better solution to this would be to configure font rendering based on the display scaling setting, so that fonts are sharp for everyone regardless of display resolution 🙂

currently the default is to have both anti aliasing and hinting on at all times; Instead, consider having anti aliasing, hinting and stem darkening in 1x mode and in 2x, HiDPi mode keep only anti aliasing, without hinting or stem darkening.

If this doesn't look better, the font is not designed correctly, I can't easily check because I changed it however.

Easy solution

Have a toggle in the settings that changes between the modes, like macOS used to. It's not as elegant but it works.

edit: here's a link to a very good blog post I found a while ago about this https://tonsky.me/blog/monitors/#turn-off-font-smoothing