Hacker News new | ask | show | jobs
by rezmason 78 days ago
Were fonts always able to do "texture healing"? Has no one tried this before?
5 comments

“Texture healing works by finding each pair of adjacent characters where one wants more space, and one has too much. Narrow characters are swapped for ones that cede some of their whitespace, and wider characters are swapped for ones that extend to the very edge of their box. This swapping is powered by an OpenType feature called “contextual alternates,” which is widely supported by both operating systems and browser engines.

Contextual alternates are normally used for certain scripts, like Arabic, where the shape of each glyph depends on the surrounding glyphs. And they are also used for cursive handwriting fonts where the stroke of the “pen” might have different connection points across letters. Texture healing is a novel application of this technology to code.”

Always able to do it? Yes. Even before OpenType alternates, the extended ligature support in TeX 3.x would have also allowed for this sort of thing.

Why has no one tried it before? Because (a) nobody thought of it and (2) OpenType alternates, while they’ve been around for a while, have not always been supported in the sorts of programs that use monospace fonts (code editors and terminals)

There have been other attempts; Commit Mono uses a slightly different approach: https://commitmono.com/ (don’t know which came first)
Over time I must have spent several dozen hours looking into fonts, but I somehow always end up sticking to Menlo which looks just right to me. But this one looks really good ! I will give it a spin, thanks for sharing.
Similar boat. Have you test-driven Andale Mono?

In the comparator page of Commit Mono, Menlo tracks wider than Commit Mono et al., which I prefer for fastest reading.

(And CommitMono looks to be a deserifed and thinned Google Sans Code, which now I think about it, is odd to have serifs...)

Fonts are software. You can program them such that any two letters beside another can render uniquely. This is most common with ligatures like (e.g. fi -> fi) but also, say, swapping a colon from baseline oriented to centered if between 2 numbers, and so on.

>Has no one tried this before?

This is a great execution of a very common font practice.

It really only makes sense on high-DPI displays (or large font sizes), which didn’t used to be that wide-spread.

Conversely, nobody seems to be doing pixel-based hinting anymore, which is why all newer fonts tend to look terrible at small font sizes on lower-DPI displays.