A tutorial I got from AI to help me improve font rendering.... And it worked fantastically
I have been raging about the font rendering on Linux for years. It just sucks. Font has jagged edges and it looks very weird. I dual-boot with windows and the font there is very nice. So, I asked Claude ai to help me and it did a great job and my font is now is actually better than windows. I wanted to share it with everyone in case you have the same issue with the font on Linux.
This post is fascinating. Most distros have good defaults for font rendering now and I haven't used hacks like infinality to fix font rendering on Linux for years. That project doesn't even exist anymore. I would be really interested to know which setting made the difference for OP and why.
I am writing this on a little HiDPI laptop with over 200dpi and to be honest hinting and sub-pixel rendering are invisible to my eyes on this device. Apple dropped sub-pixel rendering ages ago when all their products moved to retina displays. But its still really useful on low dpi displays and I thought it generally worked well enough out of the box.
A file almost identical to the local.conf has been posted to forums in the past but back then fontconfig often shipped with outdated defaults. My distro defaults have aliasing, slight hinting and sub-pixel rgb enabled out of the box.
Arch has these defaults. Bookworm lacks the sub-pixel-rgb (its just a link away) but my guess is Ubuntu derivatives probably include it:
10-hinting-slight.conf
10-sub-pixel-rgb.conf
10-yes-antialias.conf
11-lcdfilter-default.conf
The differences I see are the last 3 options in local.conf:
disabling embedded bitmaps. I think this would change rendering for old MS Office fonts. And perhaps break some emoji fonts. I have Noto Color Emoji but I don't have any old MS fonts. This seems like it would have limited impact.
enabling autohinting. If you have slight hinting enabled and the font contains hinting information it should automatically use it. So I thought it made no difference if you have good fonts installed. I might be wrong. But again if you use good fonts I am not sure this has an impact.
setting font weight to medium. This is an odd one. Does this mean that every font query returns a medium weight or that if you don't give a weight you get medium? Fattening up thin fonts might be a user preference but you can also select desired font weights in your desktop settings and apps.
Fontconfig is a compiled database for font queries, it doesn't do rendering. Whatever you put in fontconfig, an app like kitty will not implement sub-pixel rgba rendering for performance and implementation reasons but many other terminals will. I think gtk4 might be heading the same way. Depending on variations in colour vision and displays people tend to disagree on the value of sub-pixel rgb but it looks like it is a common distro default anyway.
That was a great read, although I didn't understand all of it. All I know is that my font looks fantastic now and is better than it is on windows using the same monitors. I have two 27" 4k monitors and I have been struggling with the font for a long time. No more.
I don't doubt you. Linux font rendering has been good enough for so long now that its surprising when people say its worse than some other system but I think it is still a reasonably common complaint so there has to be something to it. A lot of distros probably don't have a very good font selection installed out of the box compared with proprietary systems and I am sure that plays a role.
My desktop has a 38" ultrawide and the pixel density is a lot lower than your dual 4k monitors so I want to do everything I can for font rendering and your post has got me asking questions. I am in the process of configuring a minimal, low distraction tiling wm setup for a bit of fun (also another nvim conf spring clean). I hadn't considered changing the font rendering defaults.
I think I have all the fonts you list installed except for Hack. Inter is also a good one for UI. I don't use Fira Code anymore for code/terminal but I keep it around. It is a nice code font with ligature support but it didn't have an Italic variant and I like subtle use of italics in code and docs. Currently using Iosevka for mono but next week it might be something different.
I use segoe variable for the system and Jetbrains mono font for the terminal and and whatever the default that comes with jetbrains Rider. KDE plasma a ton of that Noto Sans font. Around 60 if I'm not mistaken. I've deleted a bunch of it with other languages that I don't need (not sure if that's a good idea, but it was annoying scrolling through all these fonts to find the one I want). Whatever Noto Sans that has a country name at the end of it I deleted it.
Having comprehensive unicode language coverage on a free OS is amazing. I wish the font system was smart enough to hide Noto variants in creative apps but leave them available for browsers. There is a workaround to do that but its a huge pain. I wouldn't delete any files managed by the package system. They will just keep coming back anyway. There are smaller collections of noto fonts in AUR that will satisfy the noto-fonts dependency which should keep KDE Plasma happy. They should be a straight swap if you are comfortable with an AUR dependency for a functioning desktop. The newer one is noto-fonts-main updated this year or there is an older noto-fonts-lite. Not tried either. Usual stuff about backups and taking advice from strangers on the internet.
Segoe might benefit more from the embedded bitmap or autohint settings than the regular open source fonts I am likely to use. Microsoft would optimise the hell out of it to take advantage of their proprietary, patented font rendering system. I wouldn't be surprised if it rendered poorly with distro defaults. Its the kind of blind spot a lot of open source devs and packagers could easily have. Its probably packed full of embedded bitmaps for small sizes and proprietary hinting stuff that linux won't understand.
Man, this is nice. Having an actual productive conversation on the internet without the battle of upvotes and downvotes. Lol
Anyway, I'll watch the system and see if things are missing after removing those fonts. All what I removed was any
noto sans + <a country whose language I don't speak>