Live data from Hacker News

Ligatures in programming fonts

tinyletter.com

1–10 of 87 posts

Re: Ligatures in programming fonts

#3
post #2

I didn't even know those were a thing But in a monospace font? No. No. No. no. No. Epicly bad plan to use something like that to display code

What's bad about them? (I find the arguments in the link interesting, but not all that convincing)

Re: Ligatures in programming fonts

#4
post #2

I didn't even know those were a thing But in a monospace font? No. No. No. no. No. Epicly bad plan to use something like that to display code

Have you tried it? Its actually quite nice. You don't have like it yourself, but you don't need to declare it bad for everyone else

Re: Ligatures in programming fonts

#6
I use fonts with ligatures while programming because they're more expressive of intent. Many languages use a combination of characters to form a single meaningful token, such as JS with =>. This token is meant to appear similar to an arrow, and has nothing to do with = or >. In this case, I find it preferable to draw a ⇒.

Re: Ligatures in programming fonts

#7
The first problem isn't really a problem, since ligatures are provided by fonts, not character encodings. From the Unicode FAQ on ligatures and digraphs (http://unicode.org/faq/ligature_digraph.html):

"The existing ligatures exist basically for compatibility and round-tripping with non-Unicode character sets. Their use is discouraged. No more will be encoded in any circumstances.

"Ligaturing is a behavior encoded in fonts: if a modern font is asked to display “h” followed by “r”, and the font has an “hr” ligature in it, it can display the ligature. Some fonts have no ligatures, some (especially for non-Latin scripts) have hundreds. It does not make sense to assign Unicode code points to all these font-specific possibilities."

The second problem still stands, though, especially since these sequences of characters can be tokenized differently in different programming languages. IMO, if you're going to have character replacement like this, it should be a configurable editor feature like syntax highlighting.

Re: Ligatures in programming fonts

#8
It seems there is some confusion for the author between the display part and the on disk part. text will not be saved with the ligature, it will still be pure unadorned text when saved... and for the confusion that could arise between a simple quote and a typographic one, it's not coming from the font but from the editor rendering engine (word does those kind of change, IntelliJ does not for example, but both can display correctly ligature)

Re: Ligatures in programming fonts

#9
The article lists a bunch of non-issues. Yes, you can create confusion by abusing unicode.

But that's not new. C++ allows zero width spaces in identifiers. There's a guy on reddit who uses characters from Canadian Aboriginal Syllabics block to have angle braces in Go identifiers.

Yes, they are guaranteed to be wrong sometimes. The big one is the But it's incredibly obvious when they are wrong. So it's not an issue in practise.

The reality is that no one is making anyone use a ligature font, and some people like them. If it's causing a problem then you can spend ten seconds changing your font.

Re: Ligatures in programming fonts

#10
post #3
post #2

I didn't even know those were a thing But in a monospace font? No. No. No. no. No. Epicly bad plan to use something like that to display code

What's bad about them? (I find the arguments in the link interesting, but not all that convincing)

Can't guarantee 80 characters length easily.
Post reply on HN