Hacker News new | past | comments | ask | show | jobs | submit login
Playing with fonts (nixers.net)
66 points by Moist-Toes 13 days ago | hide | past | favorite | 9 comments





This is a great post. I love messing with fonts on Linux, but I ended up with settings that work great for me years ago, so I don't do it much any more. (The game changer was when many of the infinality patches were rolled into fontconfig, so you don't need to build it yourself any more to get great rendering.)

The most important takeaways if you're on Linux:

1. Make sure you have autohint=false (except for individually chosen fonts that might need it). You don't want the renderer ignoring the individual font's hinting information and trying to do it itself: results are usually quite bad.

2. Make sure you have the correct subpixel rendering for your screen (usually rgb) and enable the lcdfilter. I prefer "lcdlight". Comparison of different lcdfilter settings here: http://www.spasche.net/files/lcdfiltering/

3. Consider disabling hinting entirely. I hate it. On a high DPI screen, you don't need hinting at all, because the edges of a glyph will already align very closely with the pixels. On a low DPI screen, especially as you get down closer to 96 dpi, the amount of distortion needed to align the font with the grid completely mangles it. You might think there's a sweet spot where hinting makes sense, but I've never seen one.

The article actually has a picture illustrating this beautifully: look how much better the unhinted rendering is than the hinted one! https://venam.nixers.net/blog/assets/fun_with_fonts/ftdiff_v...

If you do disable hinting, you should also change your desktop environment's default fonts to a family that has very good unhinted pixel alignment even at small sizes. I use Adobe's "Source" family, and it looks fantastic, even at my desktop's 10pt default size.


The last example you provided is very helpful, thanks. I'm surprised that the unhinted rendering is so good.

> Antialiasing: Applying a light shade around the glyph. It is useful at small scale, when you don’t have enough pixels, but it makes the glyph look bolder.

No, poor antialiasing makes the glyph look bolder. Specifically, drawing the antialiased text without taking into account screen gamma causes that.

edit Noticed this also:

> lcddefault is color-balanced and normalized

You’d expect it to be, but not everywhere. The filter sum is ~1.4 or so with many libraries. This is to offset the gamma problem I mentioned above. I think skia’s renderer now actually does have sub-pixel gamma correction, and is properly normalized.


And Mac's (subpixel only?) antialiasing algorithm thickens text beyond its true borders. There may be a way to disable this globally though.

I personally prefer all antialiasing off (especially subpixel, which looks good at first but feels fatiguing to read and eventually causes tears and headache), and found the fixed-width bitmap font he uses to caption the images the most readable of all --- it appears to be one of my favourite fonts, the X Fixed family: https://en.wikipedia.org/wiki/Fixed_(typeface)

misc-fixed are really great fonts (I wish they handled devanagari/indic scripts - that unfortunately seems unlikely to happen: https://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html , though some of them do handle other abugidas like ge'ez/ethiopic)

No text looks better or reads more easily to me while coding than a monospaced bitmap font at about 10pt and 100ish DPI. (And yes, I've read properly antialiased text on a high DPI screen).

Of course this is probably a product of nostalgia and familiarity as much as it is actual general readability.


I have no nostalgia associated with pixelated or bitmap fonts, but I agree. So it might not entirely be your nostalgia leading you to the preference :p

After using bitmap fonts for a while I can't help but notice how imperfect antialiasing, and other ways of smoothing fonts are.

To the point where it distracts me. For example, when using Windows Terminal; "Huh? Is that font meant to look like that? Better check all my windows font settings and use that pointless wizard for the 5th time".

I cannot use a terminal font on *nix that isn't a bitmap font. I hate anything else.

That being said I haven't tried any of the tricks in the article, maybe those will sort out my problems with my non-bitmap font rendering.


its sad getting readable fonts in linux is still a bit of a waste of time



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: