Live data from Hacker News

Ligatures in Programming Fonts: Hell No

practicaltypography.com

71–80 of 89 posts

Re: Ligatures in Programming Fonts: Hell No

#71
post #42

Usually, the author is spot-on with his recommendations and I really enjoy reading his website. So I was a bit surprised about this: > When we’re using a serifed text font in ordinary body text, we don’t have the same considerations. An fi ligature always means f followed by i. In that case, ligature substitution that ignores context doesn’t change the meaning. Maybe this is different in English typography - I'm a bi…

Perhaps, but the automatic ligature substitution doesn't know that, and indeed in Times "Kauflete" is rendered with a ligature. Probably because native English speakers aren't used to accent or ligature rules. Anyway, I too agree with the author; if you want ≥ to appear on your screen, it should be in the source text as the UTF-8 bytes for U+2265 and the tooling should understand it. Programming is too fragile to all…

I've used emoji and other astral planes characters in git commits and variable identifiers and haven't seen a tool break yet.

Re: Ligatures in Programming Fonts: Hell No

#72

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…

My counter-argument: eslint and tools like that will warn or error when you use `==` when you should be using `===`, up to the point where `==` is considered a code smell (JS's 'loose' comparison has been the target of a lot of brouhaha)

While readability decreases the chances of bugs, it's not the only function of readability, not by a longshot.

Re: Ligatures in Programming Fonts: Hell No

#73

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…

It's one thing to write code with Unicode characters like ≢. That should be fine, and it's not difficult for programming languages to support it. (You could roll your own preprocessing tool).

Doing it with ligatures is not a great idea, because ligatures are a PITA (not always well supported) and add too much incidental complexity.

Re: Ligatures in Programming Fonts: Hell No

#74
post #9

> So what’s the problem with programming ligatures? // They contradict Unicode. The Unicode ligatures in the Alphabetic Presentation Forms block (U+0FB00 - U+0FB4F) are only present for compatibility purposes, so that legacy texts in encodings which contain precomposed ligatures can be losslessly reencoded to/from Unicode. They aren't meant to represent the entirety of all ligatures.

Also, the author's follow on implication that Unicode only encodes one version of something that visibly looks the same is also false. It's exactly why we have things like punycode in browser URL bars, and even various "normalization standards" to compare multiple means of encoding similar characters.

Not to mention entire languages that build structure as complex combining sequences, including emoji and its complex ligatures combining the Zero Width Joiner and multiple emoji into single result emoji.

Re: Ligatures in Programming Fonts: Hell No

#75

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…

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

I'm more looking for an example of where ligatures will cause problems while programming.

Re: Ligatures in Programming Fonts: Hell No

#76
post #59

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…

I'd argue the inverse. In my experience removing the gaps makes some symbols harder to read. Like distinguishing `==` and `===` without gaps is harder, though admittedly three-bar helps. Also, I find the ligatures I've tried a bit of an eye-sore, but that's just personal taste. What's a more serious concern is the "dumbness" mentioned in the article and the handling of ambiguous cases. To give my own example, in addi…

Well it is a matter of personal taste, isn’t it? For me it is just the opposite, the visual appearance of the ligatures burned itself itnto my brain in away that it is easier to spot when it is not there. Sometimes something not converting to a ligature can also be a hint (e.g. for a wrong hyphen beeing used etc)

Re: Ligatures in Programming Fonts: Hell No

#77

Earlier quoted context omitted.

No I do not what some ide to start fucking about with code and introducing god only knows strange edge cases. And I use profanity (Engineering language) for good reasons here can you imagine any other engineering discipline allowing this to happen - oh yes the CAD system added a ligature in the bridge design blueprints !!

Ligatures in your editor don't change the underlying, code they just change the presentation of that code when you're viewing it. While a ligature supporting font may show you ≥, the underlying source file still contains the distinct characters >=

yes "up to a point lord copper". What what happens when this code is copy pasted, moved between machines in different countries or edited in multiple different editors you can get bizarre problems.

Even moveing excel between countries gets some very strange changes Eg changing diacritical's but they look very very similar.

Re: Ligatures in Programming Fonts: Hell No

#78
post #59

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…

I'd argue the inverse. In my experience removing the gaps makes some symbols harder to read. Like distinguishing `==` and `===` without gaps is harder, though admittedly three-bar helps. Also, I find the ligatures I've tried a bit of an eye-sore, but that's just personal taste. What's a more serious concern is the "dumbness" mentioned in the article and the handling of ambiguous cases. To give my own example, in addi…

The article is "ligatures are always wrong for everyone in code" and your position seems to be "ligatures are wrong for me and people who are reading my code in their editor".

I don't think anecdotes of cases where ligatures fail support a case for them being wrong for all people and all situations.

Personally, I've never had a single instance of them doing something dumb in 2+ years of using them. Never a single instance of them creating any ambiguity or failing to add clarity to my reading of code. Dumb in "theory" might be smart enough 99% of the time.

Just in the last couple months, I had to review code without the aid of a linter and they were invaluable.

Post reply on HN