Live data from Hacker News

Monospaced Programming Fonts with Ligatures

hanselman.com

141–150 of 246 posts

Re: Monospaced Programming Fonts with Ligatures

#141
One thing that really annoyed me in some monospaced fonts with ligatures is the [] ligature, I never understood why would someone rather see a box instead of two brackets. I'm no typographer, but I think that it makes the text lose its uniformity, because [] and [0] will look weird close to each other.

I guess I'm not alone in this, because in the Fira Code repo there's this commit from 2 months ago: "Remove [] ligature from specimen".

Re: Monospaced Programming Fonts with Ligatures

#142

> 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…

Agree on indentation-only-style. Alignment is just a painful mess to maintain every time I encounter it.

Re: Monospaced Programming Fonts with Ligatures

#143

> 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…

Great answer, thanks for that insight! (I was just joshing!)

> I was just joshing!

I know, and I apologize for hinting that you of all people may have lacked intellectual curiosity! That comment was really directed toward the former CEO of mine... :-)

Actually I'm glad you put in that little joshing swipe against us proportionalites, as it gave me an excuse to have some fun exploring the topic.

Re: Monospaced Programming Fonts with Ligatures

#144
post #33

Apparently I'm one of the two users of proportionality spaced fonts for coding. I've used this now for five years and I don't understand why developers still see this need to code as if monospaced terminals is all that's available. Especially on large screens with high dpi it reads much faster. It also makes it less awkward to use editor unicode substitution for display purposes.

I also prefer proportional fonts, but some people's "ASCII artsy" programming styles, along with editors themselves, make it hard to use readable fonts in practice.

What I would like is a language-aware editor that can visually align assignments, parameters, etc. without touching the actual whitespace characters. You get 1 tab for indentation (if the language allows tabs) and 1 space for alignment, and the editor takes care of the rest. The raw text would still be readable enough and use fewer bytes for people who prefer to code in a monospace terminal over SSH over an acoustic coupler from a phone booth in rural Texas.

Re: Monospaced Programming Fonts with Ligatures

#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.

Re: Monospaced Programming Fonts with Ligatures

#146

> 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…

[deleted]

Re: Monospaced Programming Fonts with Ligatures

#147

> 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…

To each their own. Personally I dislike nested function calls in general and would use intermediate variables with descriptive names. var calculatedOne = andthisCalculatedOne(anArgumentThatMeansSomething, anotherWordyName); myFunctionThatDoesStuff(someArgument, calculatedOne); Edit: That "anotherWordyName" is supposed to be column justified, HN really needs tags instead of this indentation nonsense. The extra vertica…

> Personally I dislike nested function calls in general and would use intermediate variables with descriptive names.

Oh, I agree completely that step-by-step is often more readable than deep nesting.

OTOH, your example is a good illustration of the problems with column indentation. If it hadn't been HN's goofy code formatting that messed you up, it would have been some code refactoring that changed the length of one of those variable or function names.

Re: Monospaced Programming Fonts with Ligatures

#148
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.

I tried it and instantly switched all of my editors and terminals over - it's clear, legible at different sizes, and the monospace script "italics" are great for variable names, comments etc.

Re: Monospaced Programming Fonts with Ligatures

#149
post #59

Fira Code looks really nice. Shame Sublime Text doesn't support ligatures. Seems to be the most voted for idea for development: http://sublimetext.userecho.com/forums/1-general/

Try VS Code. There's a Sublime Text keymap https://marketplace.visualstudio.com/items?itemName=ms-vscod...

Re: Monospaced Programming Fonts with Ligatures

#150

This is a deeply personal choice, I feel. I am not a fan of using ligatures in programming code as it gives some abiguity around how many characters are in a given ligature. To each his/her own, I guess.

Does it? In monospaced fonts, you can use width to know how many characters are in a ligature.

The issue, at least for me, isn't that it makes it impossible to figure out how many characters a ligature is (since, as you noted, it doesn't), but that it adds some ambiguity, especially when taking a quick glance. Ambiguity can slow down parsing (in the brain) and potentially lead to errors (in the code) if I mistakenly think a ligature is a single character.

For instance, in the examples from the article, the == and -> ligatures in particular look like something I might not always see as two characters.

Post reply on HN