Live data from Hacker News

Ligatures in Programming Fonts: Hell No

practicaltypography.com

21–30 of 89 posts

Re: Ligatures in Programming Fonts: Hell No

#21

I thought programming fonts are typically monospaced, which means collisions (which create the need for ligatures) aren't much of an issue. I agree that ligatures aren't good in programming, but it just seems the need wouldn't be that great. Or am I missing something?

Ligatures in programming fonts usually don't want to solve the problem of character collisions. Instead they transform rather weird symbol sequences used in programing to something closer to symbols used in maths or how you would write it by hand, e.g. != becomes ≠, =https://github.com/tonsky/FiraCode

Re: Ligatures in Programming Fonts: Hell No

#22
Ligatures work well enough when selected properly for the target language, since the often substitute for what the language designer was using ASCII art to approximate.

Still, Perl 6 I think has the better solution: use Unicode well with ASCII fallbacks. Combine it with editor language modes that are aware of the equivalents and do Unicode substitution when the ASCII combo is used, and you get a situation all-around better than ligatures.

Re: Ligatures in Programming Fonts: Hell No

#23
post #18

Used judiciously, ligatures can help make code more readable, not less. Consider JavaScript's == and ===, and their inverses != and !==. I personally find them difficult to visually distinguish on occasion (especially the negative forms). Fira Code [0] replaces them with two-bar and three-bar equals signs (something like =, ≠, ≡, and ≢, only wider; see the link for a screenshot). I personally find these easier to dis…

> Fira Code [0] replaces them with [...] And that's how it should be done. If you want something modified visually then you can modify it for yourself without pushing it on the rest of the world. Edit: Disregard that, I was being dumb.

but that's how programming ligatures work? Or, what is it that you're getting at?

Fonts with ligatures, such as Fira Code or Hasklig, work by replacing characters with a ligature. The actual source code is still "->" or "===" or "|>" or whatever it may be.

No one is "pushing it on the rest of the world"?

Re: Ligatures in Programming Fonts: Hell No

#24

I thought programming fonts are typically monospaced, which means collisions (which create the need for ligatures) aren't much of an issue. I agree that ligatures aren't good in programming, but it just seems the need wouldn't be that great. Or am I missing something?

I always code in a proportional font, but even there the typical operator character sequences like == don't collide or run together.

OTOH, perhaps because I use a proportional font, I would be curious to try one with operator ligatures. The interesting thing is that a ligature for !== wouldn't have to be three characters in width to preserve alignment, it could actually be the normal ≢ glyph.

This suggests an experiment: I'm already using a modified version of Trebuchet MS (my favorite coding font, but the tilde sucks so I swapped one in from a different font), so I could probably add some ligatures like the one above using existing glyphs instead of having to draw them by hand. I will have to try it sometime!

Re: Ligatures in Programming Fonts: Hell No

#25
post #4

The article would have been a lot better if there was at least one example of where a coding ligature was a problem, rather than talking about feet and inches For instance it mentions the pairing => but provides no examples. After reading I’m far from convinced that carefully curated language specific ligatures are a bad idea.

Here's an example: https://github.com/tonsky/FiraCode/issues/751

Re: Ligatures in Programming Fonts: Hell No

#26
I've been using Fira Code pretty much since its inception, currently trying out Hasklig.

I never want a programming font without ligatures ever again.

This article, to me, seems like a case where the authors' ire is proportional to a) their understanding of the subject b) how relevant the topic is.

Because really, a) ligatures won't cause catastrophic failures by rendering code illegible and b) it really, really doesn't matter all that much. Non-destructive personal preference.

Re: Ligatures in Programming Fonts: Hell No

#27

If anybody wants an example of where ligatures will cause problems, try playing a roguelike in a console using the Fira Code font with ligatures turned on. It demonstrates that accidental collisions end up with completely different glyphs. My first experience with this was with Dwarf Fortress in text mode. But... I have to say that this is the only place I've actually come across it. I eventually decided that I don't…

> try playing a roguelike in a console using the Fira Code font with ligatures turned on

But... why? It's obviously not intended for that purpose. You would get awkward results trying to program with a regular serif, too, but that's not a fault of the entire category of serifs.

Re: Ligatures in Programming Fonts: Hell No

#28
post #21

I thought programming fonts are typically monospaced, which means collisions (which create the need for ligatures) aren't much of an issue. I agree that ligatures aren't good in programming, but it just seems the need wouldn't be that great. Or am I missing something?

Ligatures in programming fonts usually don't want to solve the problem of character collisions. Instead they transform rather weird symbol sequences used in programing to something closer to symbols used in maths or how you would write it by hand, e.g. != becomes ≠, = https://github.com/tonsky/FiraCode

Ah, gotcha. Based on the examples given (e.g., Th), I got the sense he was talking about letters.

Re: Ligatures in Programming Fonts: Hell No

#29

Fira Code's main problem is that it tries to be a font for all programming languages which results in some weird behaviours here and there. Unfortunately, there's no good way to have a font have sets of ligatures per . That said, however, the article fails to provide a compelling argument against ligatures. 1. Fonts have nothing to do with Unicode. It's exactly the font's job to provide any glyphs or ligatures it wan…

> Computers have all but destroyed typography, and it's a good thing some of it is coming back

Absolutely agree. Medium.com (as an example) has a bunch of flaws, but some of my favorite articles are their posts about bringing classical typography back to the modern web.

Re: Ligatures in Programming Fonts: Hell No

#30

Used judiciously, ligatures can help make code more readable, not less. Consider JavaScript's == and ===, and their inverses != and !==. I personally find them difficult to visually distinguish on occasion (especially the negative forms). Fira Code [0] replaces them with two-bar and three-bar equals signs (something like =, ≠, ≡, and ≢, only wider; see the link for a screenshot). I personally find these easier to dis…

To be fair, I find the "www" ligature to be a bit unnecessary, but apart from that I love the ligatures in Fira Code.
Post reply on HN