Live data from Hacker News

Monospaced Programming Fonts with Ligatures

hanselman.com

151–160 of 246 posts

Re: Monospaced Programming Fonts with Ligatures

#151

> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…

I would probably want to hit you with a baseball bat if I had to spend any time reading your code with my monospaced font. At least for the type of code that I work in that lends itself to code alignment.

> I would probably want to hit you with a baseball bat if I had to spend any time reading your code with my monospaced font.

Well, that's a good way to get a head start on the "hell or purgatory" thing, isn't it! :-)

I'm not saying every kind of code is suited for a proportional font. If you use ASCII art, or if you are writing out two-dimensional matrices or the like, a monospaced font will serve you better.

The kind of casual and unnecessary column alignment in my first example is what I was talking about. The second (indented) example is perfectly readable in either a monospaced or proportional font. So if you run across it you hopefully won't need your baseball bat.

Re: Monospaced Programming Fonts with Ligatures

#152

> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…

> For example, it cured the bad habit I had of lining too many things up in columns I don't like this style either, but it's a style not a "bad habit."

It's a decision with a lot of downsides. Each one not very significative, like polluting diffs, that add into a mild nuisance.

Re: Monospaced Programming Fonts with Ligatures

#153
post #15

I like switching fonts every couple of years just to keep it fresh. My font right now is Iosevka: https://be5invis.github.io/Iosevka/ A font generated from its source code. You can build your own variant. It has ligatures as well. I like that it’s not as wide as many other monospace fonts.

I love Iosevka Term! My only issue with it is that there seems to be a problem in Emacs 25 that makes the screen flicker once in a while when I use it. For Emacs, I like to use Fantasque Sans Mono, another amazing font.

I have this exact same problem! Never connected it to the font. I was tearing my hear out

Re: Monospaced Programming Fonts with Ligatures

#154

Earlier quoted context omitted.

HN is a web page, and HTML swallows multiple-spaces into a single space.

Let me test                 something. Edit: crap, doesn't work

I'm pretty sure that if HN allowed you to do what you just tried, it would be a XSS vulnerability. :P

Re: Monospaced Programming Fonts with Ligatures

#155

> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…

> For example, it cured the bad habit I had of lining too many things up in columns I don't like this style either, but it's a style not a "bad habit."

nah, it's a bad habit.

It means constant readjustment and unnecessarily bloated diffs every time you change a function or variable name.

or the lovely

  foo := a;
  bar := b;
then a day later

  foo    :=  a;
  bar    :=  b;
  foobar := cd;
which also points to the problem that it lends itself to premature constant readjustment because a day later you have to move every thing again because as it turns out you really needed foobarlist as well. and each time you end up with a diff reporting that foo and bar (and then foobar) have changed too.

It's making busy work for yourself and ruining the usefulness of code review tools.

ALSO alignment vs indentation is the whole reason we have to have the spaces vs tabs argument.

Re: Monospaced Programming Fonts with Ligatures

#156
post #145

> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…

There is another example of when mono spacing is useful; multiple calls to the same function with diffrent arguments. But that's basically hardcoded tabular data, and should really be solved by an editor with proper tab-stops. Not by abusing the monospaceivity and spaces for alignment.

But that's basically hardcoded tabular data, and should really be solved by an editor with proper tab-stops. Not by abusing the monospaceivity and spaces for alignment.

That’s the crux of the issue for me.

I can think of many ways I’d like to present code in my idealised programming language(s) that would use significantly more advanced layout and typography than today’s typical environments.

However, I wouldn’t actually want to use any of them unless my programming tools all supported them properly. That means the editor, but also the source control and diff tools, the code review and bug tracking systems, and so on.

In the absence of any standard conventions for how to represent that extra metadata in an underlying format as robust and flexible as plain text, it’s hard to see this ever happening, though I imagine it would be fun to try.

Re: Monospaced Programming Fonts with Ligatures

#157
post #53

It's $CURRENT_YEAR. Just let people write ≠ for ≠ already.

The problem with Unicode operators is good, consistent input methods.

For those of us who use programmable keyboards, it's not a problem at all.

For everyone else, perhaps it should be seen as an editor problem? There's no reason vim can't see that you type != or =/= and replace it on the fly with ≠.

Re: Monospaced Programming Fonts with Ligatures

#158
post #46

Ligatures are great, but I just love the cursive italics used by Operator Mono. Haven't justified the price to myself yet, but am considering it since I haven't been able to find any other fonts that do cursive italics.

Matthew Butterick’s font Triplicate has true italics and a Code version with programming alternates.

www.triplicatefont.com

Re: Monospaced Programming Fonts with Ligatures

#159

Earlier quoted context omitted.

> For example, it cured the bad habit I had of lining too many things up in columns I don't like this style either, but it's a style not a "bad habit."

nah, it's a bad habit. It means constant readjustment and unnecessarily bloated diffs every time you change a function or variable name. or the lovely foo := a; bar := b; then a day later foo := a; bar := b; foobar := cd; which also points to the problem that it lends itself to premature constant readjustment because a day later you have to move every thing again because as it turns out you really needed foobarlist a…

> alignment vs indentation is the whole reason we have to have the spaces vs tabs argument.

Indeed, that is one of the things I like about the indentation-only style. Unlike column alignment, you can use either spaces or tabs for indentation and the formatting still comes out fine.

Re: Monospaced Programming Fonts with Ligatures

#160

Earlier quoted context omitted.

Let me test                 something. Edit: crap, doesn't work

I'm pretty sure that if HN allowed you to do what you just tried, it would be a XSS vulnerability. :P

Nah, you can do it on Reddit because they use Markdown instead of HN's homegrown comment formatter. In case you ever need to post a proportional font code sample over there, the trick is to use   for all the leading spaces, and also add two regular spaces at the end of each line before the last one.
Post reply on HN