I decided to try using proportional fonts for coding starting a year or two back. It worked out well and I stuck with it, because proportional text is easier for me to read on the whole, and because it allowed more characters to fit comfortably on each line on average. I did find after a while that occasionally the lack of alignment between characters on two subsequent lines was a problem, but then I configured my editor so that it showed comments and text strings in a monospace font and that fixed the problem for me.
bgrainger 23 hours ago [-]
I first encountered this in Bjarne Stroustrup's 2000 book, _The C++ Programming Language_. As he notes in the introductory material:
> In code examples, a proportional-width font is used for identifiers. … At first glance, this presentation style will seem “unnatural” to programmers accustomed to seeing code in constant-width fonts. However, proportional-width fonts are generally regarded as better than constant-width fonts for presentation of text. Using a proportional-width font also allows me to present code with fewer illogical line breaks.
I switched years ago and would never go back to monospace.
efortis 21 hours ago [-]
I edited a proportional for coding, I’ve been using it for 10 years and it’s great except for tabular alignment.
So it would be nice if IDEs rich-rendered regions column aligned.
eg, object literals in JS, in which space separator are as a wide as needed to align the values.
JetBrains MPS has a decision table rendering for DSLs, which is similar to what I described.
I am curious, which editors allow different typefaces for different code elements? (XCode, I think, but what else?)
ben_pfaff 22 hours ago [-]
I use Emacs.
alwillis 23 hours ago [-]
I’ve been using Monaspace with Neovim for at least a year.
alwillis 23 hours ago [-]
Also terminal apps like Ghostty, Wezterm.
CharlesW 1 days ago [-]
This seems a great solution, and I'll definitely be trying it. I feel like monospace fonts are the Roman roads → horse ruts → rail gauge of our industry.
endunless 1 days ago [-]
I do like these fonts, but DJR had this idea with the (excellent) Input family of fonts years ago:
Unfortunately until editors start supporting this (and I’m not sure what would motivate them to), these remain great ideas only.
sheiyei 1 days ago [-]
Input's method seems to be fundamentally very different to this. Monaspace keeps the grid intact and only changes the characters visually (situationally overlaps wide letters to neighbouring narrow characters' spaces). Input just pretends to be monospace in its aesthetics, I don't really understand what's supposed to be special with that.
endunless 1 days ago [-]
Fair points on the technical implementation.
I more meant the idea of using different fonts in the same buffer to represent different kinds of text.
asibahi 1 days ago [-]
Input is a proportional font.
Monaspace is a monospace font that uses contextual alternatives: it changes how letters look depending on surrounding letters.
They are nothing alike in their approach to this problem.
(Also this is a marketing piece. Contextual alternatives is not a new tech.)
naikrovek 1 days ago [-]
> Input is a proportional font.
it is also a monospaced font
asibahi 23 hours ago [-]
Yes there is a version of Input that is a monospaced font and doesn't solve the problem tackled by Monaspace and the proportional version of Input and is therefore as relevant to this discussion as .. I dunno .. Courier New.
pfortuny 1 days ago [-]
Honest question: does emacs (GUI) not support this?
ramblurr 23 hours ago [-]
Emacs totally supports this!
Mixing monosoace and proportional fonts can be a little strange, but there are some 3rd party packages or guides (prot has one iirc) to workaround it.
actionfromafar 1 days ago [-]
Which editors?
endunless 1 days ago [-]
Given GitHub is owned by Microsoft, I think VS Code supporting mixing fonts in a buffer would be a good start!
alwillis 23 hours ago [-]
Yes, I configured VS Code to use Monaspace a while ago.
sombragris 1 days ago [-]
When I saw the Monaspace family linked in a HN frontpage some time ago, I installed the whole family, and now my terminal font is Monaspace Neon. I also type my LaTeX code in Monaspace Argon. They won me over Iosevka.
Not a fan of “texture healing”, a very convoluted and unsatisfying way of fixing a minor problem with monospace fonts, I’d be more interested in seeing letterforms redesigned to be more optically balanced within the grid, another commenter points out ubuntu mono does this somewhat, but I imagine you could make some fairly radical alterations to certain letters and still be legible.
rezmason 1 days ago [-]
Were fonts always able to do "texture healing"? Has no one tried this before?
fontain 1 days ago [-]
“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.”
dhosek 1 days ago [-]
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)
micampe 1 days ago [-]
There have been other attempts; Commit Mono uses a slightly different approach: https://commitmono.com/ (don’t know which came first)
makizar 22 hours ago [-]
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.
Terretta 8 hours ago [-]
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...)
hbosch 20 hours ago [-]
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.
layer8 1 days ago [-]
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.
exceptione 1 days ago [-]
Very useful to mix and match various fonts based on semantics. I have a problem with Radon's l though, to me it reads like chumiZy and xenoZith. I don't understand how this could have slipped through, I can't be the only one being constantly confused.
ZeroGravitas 24 hours ago [-]
A few people thought this, there's a GitHub ticket for it which they closed after they added a variant in v1.2 for a standard i and a loopy l that you can opt in to use.
Can't quickly find a screenshot though you can use web dev tools to add
I feel like that font is a real bad apple. The other ones are decent and I like the "texture healing" (but not its name)
Terretta 8 hours ago [-]
kerning, and it's been 'smart' since Linotype machines if not before.
kyle-rb 1 days ago [-]
Yeah, I think the italics compounds the problem in their comment example: // Notify aZZ Zisteners
1 days ago [-]
keeganpoppen 1 days ago [-]
i do think that the type designers did incredible work with monaspace… i used to be an Operator-exclusive kind of guy (rip hoefler x frere-jones), but i genuinely think they did enough to completely displace it from my font lexicon, which is no mean feat.
satvikpendem 1 days ago [-]
I usually stick with Apple's SF Pro Mono but I'll have to try out this font.
keeganpoppen 1 days ago [-]
i do prefer neon and argon to the rest, though i see the place for all of them to exist
jdnier 19 hours ago [-]
Finally, a bracket I can enjoy (that doesn't involve basketball).
ferd 1 days ago [-]
I really like Monaspace Argon, but even the narrower option looks too wide on my terminal (kitty on macos)
ZeroGravitas 24 hours ago [-]
Kitty has options to shrink the fonts:
modify_font cell_width 95%
But yes it seems weird that their variable font doesn't go narrower.
ferd 19 hours ago [-]
Thanks. Tried, but doesn't look good :-(
ZeroGravitas 13 hours ago [-]
It only works to a certain extent as it's more like shaving (or padding) the cell and for Monaspace in particular seems to have weird impacts on the context healing if you take it too far.
But I find it (and some vertical padding) helps get closer to the Victor Mono proportions I was used to as long as you don't go too far. It's maybe more like reducing letterspacing which Victor Mono also had less of.
Rendered at 20:08:26 GMT+0000 (Coordinated Universal Time) with Vercel.
> In code examples, a proportional-width font is used for identifiers. … At first glance, this presentation style will seem “unnatural” to programmers accustomed to seeing code in constant-width fonts. However, proportional-width fonts are generally regarded as better than constant-width fonts for presentation of text. Using a proportional-width font also allows me to present code with fewer illogical line breaks.
I switched years ago and would never go back to monospace.
So it would be nice if IDEs rich-rendered regions column aligned.
eg, object literals in JS, in which space separator are as a wide as needed to align the values.
JetBrains MPS has a decision table rendering for DSLs, which is similar to what I described.
Check out "elastic tabstops":
https://nick-gravgaard.com/elastic-tabstops/
https://input.djr.com/
A bit weird to not mention that.
Unfortunately until editors start supporting this (and I’m not sure what would motivate them to), these remain great ideas only.
I more meant the idea of using different fonts in the same buffer to represent different kinds of text.
Monaspace is a monospace font that uses contextual alternatives: it changes how letters look depending on surrounding letters.
They are nothing alike in their approach to this problem.
(Also this is a marketing piece. Contextual alternatives is not a new tech.)
it is also a monospaced font
Mixing monosoace and proportional fonts can be a little strange, but there are some 3rd party packages or guides (prot has one iirc) to workaround it.
It's what I landed on after completing the Coding Font game submitted to HN yesterday: https://news.ycombinator.com/item?id=47575403
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.”
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)
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...)
>Has no one tried this before?
This is a great execution of a very common font practice.
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.
Can't quickly find a screenshot though you can use web dev tools to add
To the interactive demo on https://monaspace.githubnext.comBut I find it (and some vertical padding) helps get closer to the Victor Mono proportions I was used to as long as you don't go too far. It's maybe more like reducing letterspacing which Victor Mono also had less of.