4 ms·
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 ligatur
by gnicholas 8y ago
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?
- mashehu 8y agoLigatures 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 ≠, =< becomes ≤, or === becomes ≡. More examples are in the repo readme: https://github.com/tonsky/FiraCode https://github.com/tonsky/FiraCode
- gnicholas 8y agoAh, gotcha. Based on the examples given (e.g., Th), I got the sense he was talking about letters.
- Stratoscope 8y agoI 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!
- zeitg3ist 8y agoCould you share a screenshot of your editor with Trebuchet? I would never think of it (or any other proportional font) as an adequate font for coding, so I’m pretty curious to see what it looks like.
- Stratoscope 8y agoSure, here's an example: https://imgur.com/482puD4 https://imgur.com/482puD4 If the text looks huge, it's because I took the screenshot on a high-DPI device with 200% scaling, sorry about that. Imagine it half the size and you will have a better idea of how it actually looks. In any case, the point is that code like this just doesn't depend on monospacing. If you viewed the same code in a monospaced font, it would look pretty much the same except for the font choice. The key is to not do column alignment tricks that assume a monospaced font, like this: doSomething(oneParam, anotherParam); Instead, if you just do indentation like this, your code will look fine with any font: doSomething( oneParam, anotherParam );