Live data from Hacker News

Ligatures in Programming Fonts: Hell No

practicaltypography.com

51–60 of 89 posts

Re: Ligatures in Programming Fonts: Hell No

#51
post #11

Earlier quoted context omitted.

Luckly on many OS the terminal is just yet another graphical application, not something trying to emulate 40 years old hardware.

(You're talking to the developer of iTerm2, which is a graphical application. iTerm2 took a while to support ligatures: https://gitlab.com/gnachman/iterm2/issues/3568 )

The nick was unknown to me.

From the ticket it seems to me that the root cause was not handling text as GUI applications are supposed to do(aka like Wordprocessors).

Re: Ligatures in Programming Fonts: Hell No

#52
post #40

Is Personally, I'd love a keyboard that had a ≤ key and a programming language that recognized that symbol.

If you want the symbol just to avoid typing an extra key, you can use a workaround.

Get a keyboard with some extra keys (or a small side-board) and just get a ≤ key. Then just program it as a macro for Wouldn't really solve the "programming language recognizing the symbol" Though that could probably be hacked in as well if you _really_ want to.

I mean, I know this is not ideal. I'm just throwing out bad ideas :D

Re: Ligatures in Programming Fonts: Hell No

#53
post #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

That's why e.g. Iosevka has language-specific ligations so you can chose between the standard, the slightly extended ML ligatures and the whole set of Coq craziness.

Re: Ligatures in Programming Fonts: Hell No

#54

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…

Sure, but try playing it with Comic Sans or Wingdings or Lobster or any other font and you'll realize why there are fonts for certain applications.

Re: Ligatures in Programming Fonts: Hell No

#55
post #43

Earlier quoted context omitted.

The whole point of ligatures is that they are visually subtle enough that you don't consciously notice them, while removing distracting collisions of adjacent glyphs. The German rule seems entirely pointless and counterproductive. That said, OP is wrong that ligatures would "break Unicode". The only ligatures that are directly encoded exist for historical reasons. Fonts can and should make contextual alternatives, an…

> The German rule seems entirely pointless and counterproductive. The rule provides visual hints for how to pronounce words. I think that is way more useful than slightly increasing the readability by joining glyphs without context.

i makes a lot of sense, just think of

    Kaufleute = Kauf ++ leute (merchant / trader, from kaufen = to buy)
    Kaufläche = Kau ++ fläche (chewing surface / morsal surface from kauen = to chew)
But I am sure only professional typographers + a small minority of pedants (in the good sense) would be aware of this.

Re: Ligatures in Programming Fonts: Hell No

#56

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…

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

Re: Ligatures in Programming Fonts: Hell No

#57

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…

> Unfortunately, there's no good way to have a font have sets of ligatures per .

But there is, see Iosevkas ligature sets which switch different ligatures on and off. The editor can just opt-in which one to use.

There might not be sufficient editor support for it but you can work around it by generating different versions of it as default and then configure your editor to use that font. Not elegant but workable.

Re: Ligatures in Programming Fonts: Hell No

#58

Earlier quoted context omitted.

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

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

Sure, here's an example:

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
  );

Re: Ligatures in Programming Fonts: Hell No

#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 addition to those in the article, I use a series of more than 3 equals signs as a delimiter in my notes. With programming ligatures it looks distractingly bad. Normally it's a continuous row of two-bars, but with them ligatured they look like morse code divided into short groups of long two-bars. Essentially, when I'm writing code or whatever, I don't want there to be someone guessing what I mean and how I want something to look. Unless he guesses always right, he's a nuisance. Sorry for the personification.

Re: Ligatures in Programming Fonts: Hell No

#60

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…

Coding with a dwarf fortress tile set is even worse :P
Post reply on HN