Live data from Hacker News

Almost monospaced: the perfect fonts for writing

blakewatson.com

121–130 of 174 posts

Re: Almost monospaced: the perfect fonts for writing

#121

Earlier quoted context omitted.

Writing programs by manipulating text is the actual limitation of the technology here, alignment is just a minor detail by comparison.

That's often heard, but what's the alternative? So far every other alternative has been more limiting, not?

There are some sane alternatives.

You can keep to mostly text, but give the editor more leeway in how to lay it out and make the code's structure more visible.

Some really simple options, that you might not even recognise as going beyond text: folding of block and go-to-definition.

Re: Almost monospaced: the perfect fonts for writing

#122
post #97

Earlier quoted context omitted.

I've been using proportional fonts in programming for about ten years. I stopped doing things like abc = 1 d = 2 which add very little readability value IMHO. Things like func(arg1, arg2, arg3) usually don't align well because func( has a different width than the five spaces in the lines below. However 1) my text editor (emacs) aligns those lines for me (probably any programmer's editor does) so at least I don't have…

Formatting your code in an unintuitive way because of the font is a code smell to me.

Viewing the examples generally, the second one better communicates hierarchy at the cost of an extra line. The arguments are all grouped together visually and without distraction, while in the first example the first argument gets muddled with the function name. Why? To save a line break?

Re: Almost monospaced: the perfect fonts for writing

#123
post #85
post #32

Earlier quoted context omitted.

I long ago concluded that trying to line stuff up in columns like this in code is a mistake. It often results in realignment of blocks for small changes so what should be a small diff in the git history ends up being big. Only rarely is the vertical alignment useful because mostly code isn't read vertically. Used in moderation, the reverse Christmas tree style used in the Linux kernel can be as good for readability (…

I stopped manually formatting code long ago, just accept what the code formatter tool decides is good enough. Saves a lot of time.

I just put stuff on one line and let the editor wrap them. Doesn't waste vertical space, compatible with any font, any size, any window width, any form factor, the best from all worlds.

Re: Almost monospaced: the perfect fonts for writing

#126

Isn't the whole point of monospaced fonts columnar alignment (e.g. the table in the article)? Seems like "almost" defeats the point. Then again, I don't see values lined up much these days: { "someKey": "someValue", "someOtherKey:" "someOtherValue, and if you only care about leading whitespace (that is, the whitespace before a character appears on the line), maybe it doesn't matter how your font is spaced. I suspect…

Another benefit of monospaced fonts is ease of calculation of text-container width: any line x character count will always be the same length as any other.

The main use of this in practice is using line-char-count limits as a proxy to lint for code readability, but it can also be beneficial in other contexts.

Re: Almost monospaced: the perfect fonts for writing

#127

I use iA Writer Duo for writing prose and fiction a lot. If you're willing to pay for typefaces, though, there's a really good "almost typewriter" font called Triplicate, which comes in four versions -- the original, a slight variation with the same metrics as Courier, a "code" version that has a few characters changed to be better for coding (this is a great alternative to the more expensive Operator Mono, in my exp…

Unfortunately applying both Poly and Code gives you an imperfect result: the default l glyph has a flat base, Poly makes it narrower, and Code makes it a curly tail, but enable both (e.g. font-feature-settings: "ss01", "ss02") and you get the Poly glyph rather than the Code glyph or a hybrid, both of which would be nicer, and MB has said “won’t fix” (and I haven’t gone to the trouble of patching it myself).

A demo of my own of Triplicate with use of both Poly and Code: https://chrismorgan.info/blog/rust-fizzbuzz/, code is all Poly + Code, compiler errors are just Code (it uses columnar alignment, so not Poly). The lowercase l can be seen in all the figures in one form or another (e.g. “else” in bold, “result” in regular, but not “println!” because italics always uses a curly-tailed l).

Re: Almost monospaced: the perfect fonts for writing

#128
post #97

Earlier quoted context omitted.

I've been using proportional fonts in programming for about ten years. I stopped doing things like abc = 1 d = 2 which add very little readability value IMHO. Things like func(arg1, arg2, arg3) usually don't align well because func( has a different width than the five spaces in the lines below. However 1) my text editor (emacs) aligns those lines for me (probably any programmer's editor does) so at least I don't have…

Formatting your code in an unintuitive way because of the font is a code smell to me.

That’s what many auto formatter do anyways, even ones setup for fixed width fonts.

Re: Almost monospaced: the perfect fonts for writing

#129

I love writing with monospaced fonts (just as the author of article says, they look "writerly"), but I detest the fonts in iA Writer. I just can't stand to look at them, so I don't use the software (which would be great if it allowed me to choose other fonts). I also hate Courier New, which is a weak and spindly font. My favorite is Courier Prime.

Take a look at Drafting* Mono: https://indestructibletype.com/Drafting/

Oh, that guy and his stupid habit of putting an asterisk in the font name—impossible to use in Emacs.

Re: Almost monospaced: the perfect fonts for writing

#130
post #86

> But there is a reason we don’t use monospaced fonts everywhere. They are somewhat hard to read because [...] Well, not sure what is the basis for that assertion, but I find it easier to read text rendered in a monospaced font (Courier is my favorite). In fact, when I need to read something longer than a minute on the browser, I switch to monospace (with help of a browser plugin). It's not about text alignment -- it…

Yeah, if everyone was used to reading monospaced fonts then proportional fonts would be hard to read. I suspect there might be a bit of an advantage for proportional in terms of ultimate reading speed in that you might be able to fit in an extra word in your scan, but the alignment of a fixed grid might help a bit too. The real value of proportional fonts is that you can print more stuff on the page and make your book shorter and cheaper. In today's world the paper is basically free, so that is no longer an issue. It just means that you have less text on the screen and will have to page a bit more often.
Post reply on HN