Readit News logoReadit News
Posted by u/rpastuszak 3 years ago
Ask HN: Anyone using proportional fonts for coding?
(I don't find them distracting and I enjoy messing with typography.)

I'm curious about any less obvious pros and cons, as well as recommendations for any fonts to try.

Renevith · 3 years ago
I've used Input Sans for years. I was expecting to have to deal with alignment issues but in my Java codebase there were almost none. (YMMV depending on language and coding style.) The only alignment we use is with leading spaces only, so everything still aligns as expected. The readability is great and I can fit substantially more characters horizontally than I could with a fixed-width font.

It definitely felt weird at first, like I was reading code that somebody had pasted into Microsoft Word. But that passed and now it's all upside.

I screen-share my IDE from time to time and I've never had anyone comment on it.

nielsbot · 3 years ago
Same here. I find it much more legible. I can also finally move beyond the teleprinter and vintage terminal screen legacy of monospaced fonts. I’m a person not a robot :)
jwells89 · 3 years ago
I've tried a few times over the years but it never sticks. Proportional fonts make scanning for character-level differences slower and most don't distinguish important characters strongly enough (e.g. parens and brackets taking less space than alphanumerics). I'll echo others' comments on alignment too.

To my eye, they also just make code look… I don't know, messy somehow? Especially with serifs it looks like a tractor trailer wrecked and spilled its payload of characters all over the place.

cacozen · 3 years ago
Try IAWritter DuoSpace: it’s a great mix between fixed width and proportional: https://ia.net/topics/in-search-of-the-perfect-writing-font
JieJie · 3 years ago
The font is a modification of IBM's Plex open font, and is available here.

https://github.com/iaolo/iA-Fonts/

kcartlidge · 3 years ago
This. I use it all the time. Every character is fixed width except 'm', 'w', 'M', and 'W', which are 150%. It mostly looks and behaves like monospace, but with a very nice minor adjustment that makes it more readable and pleasant.
CharlesW · 3 years ago
TLDR: 1,500 words on how iA created a variant of IBM Plex Mono with four 1.5X-width characters (m, M, w, W) because…well, it's not really clear.

And, they say, programmers use monospace fonts because it helps them catch typos. In reality, variable glyph widths make it easier to identify typos.

mrunseen · 3 years ago
m, M, w, W, %, @ and i, l, ! (and so on) are the letters that create a challenge (or a room for creativity/individuality) ad they are so wide or so narrow. Wide letters often get cramped as they need to share se witdh as narrower letters. iA thought they could just modify those “extreme” glyphs to increase legibility (and readability)
seanmcdirmid · 3 years ago
I’ve used proportional fonts for more than a decade now. Since auto formatters disallow ascii art or custom alignment anyways, I’m honestly not missing out on anything, and just get to enjoy kerning in my code. I use whatever sans serif is used most on my platform (ATM it’s google sans), using a serif want would probably annoy me a lot.

Oh, what we are really missing are code-oriented ligatures, like -> or ==>. Sad, but I find fixed width so bothering that I’m not willing to try the fixed width fonts that offer such ligatures.

hyperhopper · 3 years ago
> Since auto formatters disallow ascii art or custom alignment

This is not a universal truth. I've worked at faang companies that don't even do this.

In fact many great comments I've seen have been ASCII art diagrams. Those should be encouraged.

seanmcdirmid · 3 years ago
I haven’t seen any such in the last five years. Maybe C or C++ code? Java and kotlin auto formatters are pretty entrenched at this point, Python always has been, not sure about other language cultures.
eternityforest · 3 years ago
I did not know till I saw this comment how many ascii art and even diagram tools existed for vs code! I will probably be making use of some!
LorenDB · 3 years ago
Hot take: ligatures bother me nearly as much as a proportional for would bother me.
psd1 · 3 years ago
A "hot take" is an initial reaction, without benefit of much data or consideration.

Like when someone shouts to you after they've already thrown, and you must turn and catch in a fraction of a second. Or take a ball to the jaw.

You've expressed a considered preference, not a hot take.

xigoi · 3 years ago
This is a cold take. Many people on HN hate ligatures.
seanmcdirmid · 3 years ago
Sure, I mean if non-type writer fonts bother you, I’m sure other aspects of modern typography would also be off putting.
CharlesW · 3 years ago
I propose we start the revolution with comment blocks.

https://developer.apple.com/library/archive/documentation/Xc...

metadat · 3 years ago
What is the colon (:) thing about?

E.g.

    /*:
       Some comment
     */
Is there a legitimate reason for the non-C addition atop a C-syntax?

Edit: Thanks for explaining!

thristian · 3 years ago
It seems to be a convention that means "this comment contains Markdown and should be rendered in the generated documentation" as opposed to commenting out unused code or whatever.
nyolfen · 3 years ago
it's to mark the comments in these blocks to be extracted for formatted documentation generation rather than conventional code comments
exebook · 3 years ago
I made my own proportional font Variable.ttf and refined it for over a decade. I am using it daily. Over many iterations I refined space width and each important coding character's shape and size. Added some ligatures in the last few years. It's very good I consider it a work of art, and I cannot think about going back to fixed fonts. Only me and my friend use it.

https://github.com/exebook/variable

sangpal · 3 years ago
I used Input Sans for some time as my coding font. Most proportional fonts have a small <space> which makes it difficult to figure out alignment in code. Input Sans was the only font I found that was good in this regard.

I use vim keybinds and movement was too unpredictable to keep using as my main font. Now I'm back to a monospaced font.

retrocryptid · 3 years ago
I know ThinkPascal back in the day used a proportional font, but I think I remember MPW using mono. My CanonCat uses a proportional font when you write FORTH programs for it.
_moof · 3 years ago
Was just going to mention THINK Pascal. It used 9-point Geneva, and bolded keywords, if I remember correctly.
retrocryptid · 3 years ago
Yup. That's the one I'm thinking about. Oh. And an early version of MS BASIC for Mac did something similar.