Live data from Hacker News

Ligatures in programming fonts

tinyletter.com

51–60 of 87 posts

Re: Ligatures in programming fonts

#51
post #47
post #39

Earlier quoted context omitted.

If your syntax highlighting is wrong, it's buggy. Proper syntax highlighting is 100% correct.

Correct syntax highlighting is subjective, because color selection is a matter of taste.

Nope, you or I may think reserved words should be red or blue, but either the list of words that get highlighted is correct, or it isn't.

Re: Ligatures in programming fonts

#52

The author's point about "dumb" ligatures doesn't really hold up: While the "fi" ligature will always mean "f followed by i" its use is not always correct. For example, in German compound nouns, you do not set a ligature between the two nouns. For instance, "Kaufläche" (Kau: chewing, + Fläche: area) should be written with ligature, while in "Kaufleute" (Kauf: purchase, + Leute: people, = merchants) the ligature shoul…

Are there any font specifications that allow for this kind of distinction?

Re: Ligatures in programming fonts

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

I don't know what it would do to editor rendering performance, but disabling the `liga` OpenType flag for selections detected as strings would solve the majority of instances of #2

All in all though, this is a purely local dev preference matter - your editor ligature settings never affect the committed code, so neither are really a problem in practice.

Re: Ligatures in programming fonts

#54

The author's point about "dumb" ligatures doesn't really hold up: While the "fi" ligature will always mean "f followed by i" its use is not always correct. For example, in German compound nouns, you do not set a ligature between the two nouns. For instance, "Kaufläche" (Kau: chewing, + Fläche: area) should be written with ligature, while in "Kaufleute" (Kauf: purchase, + Leute: people, = merchants) the ligature shoul…

Wow, that's fascinating -- do you have a reference for that? I'd love to learn more, especially as to why -- it seems like that would just result in ugly typography. Or is it solely about the bar of the initial "f" connecting to the next letter?

Re: Ligatures in programming fonts

#55
post #32

I work with someone who uses ligatures. Everytime I need to see his screen is a problem, I can never recognize what exactly the characters mean. Yes, you get used to it if you use it, but if you don't, working with other people becomes a problem. I thought it was a bad idea the first time I saw it, and after seeing it in real code I still think the same thing.

Yes, I hate seeing code any way except precisely tuned emacs. I like small sized characters, but most of fonts looks ugly, you'll need use antialiasing to preserve shape, but some chars becomes unreadable with antialiasing. Except of font choosing I'd like to see familiar color theme. And when I see code in someone's else editor its hard to read.

But, you know, others didn't like my emacs setup, they says that its hard to read in such small sizes, and my color theme with dark background is bad for their eyes. Strange people, what on earth make them think, that I should be considering their eyes health while choosing font and color theme for myself?

Re: Ligatures in programming fonts

#56
post #29
post #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…

I gifted that guy gold for the sheer audacity of the thing.

How much gold?

Re: Ligatures in programming fonts

#57
post #39
post #36

Honestly, this sounds like the kind of argument you could present about how syntax highlighting is a terrible idea. It might be wrong! I don't use ligatures, but I really don't see a problem with other people using them. It's fine, it's a style preference thing, that, like fonts and colour schemes, is as much fashion and personal preference as it is anything. But it's fine.

If your syntax highlighting is wrong, it's buggy. Proper syntax highlighting is 100% correct.

Depending on your language, proper syntax highlighting (without parsing the entire program) is nearly impossible.

For example, in C, what highlight category do you give to '*c'? A declaration, a dereference, or a multiplication call?

In Lisp, is the first element of a list a macro or a function (or a value)? If there's a reader macro, it gets even harder.

Re: Ligatures in programming fonts

#58
post #52

The author's point about "dumb" ligatures doesn't really hold up: While the "fi" ligature will always mean "f followed by i" its use is not always correct. For example, in German compound nouns, you do not set a ligature between the two nouns. For instance, "Kaufläche" (Kau: chewing, + Fläche: area) should be written with ligature, while in "Kaufleute" (Kauf: purchase, + Leute: people, = merchants) the ligature shoul…

Are there any font specifications that allow for this kind of distinction?

Every font with ligatures allows for this, because they also include glyphs for the component parts of the ligatures. It's the responsibility of the typesetting software to enable or disable ligatures as required, eg. with this TeX package for selective suppression of ligatures:

https://www.ctan.org/pkg/selnolig?lang=en

Re: Ligatures in programming fonts

#59
post #36

Honestly, this sounds like the kind of argument you could present about how syntax highlighting is a terrible idea. It might be wrong! I don't use ligatures, but I really don't see a problem with other people using them. It's fine, it's a style preference thing, that, like fonts and colour schemes, is as much fashion and personal preference as it is anything. But it's fine.

I think this comment gets at the root of the issue. This is syntax highlighting, but it's done by the font rendering engine and it has no context.

Syntax highlighting without context is not really a good experience. The highlighter needs to know what language you're using, and a pretty good idea of how to parse it.

And the comment on ligatures below points out, this is actually true of ligatures for human languages as well, but I doubt the font engines are properly tuned for that either. I'd make an exception for the 'obvious' ligatures like gg gy etc where the descenders were overlapping without a ligature. That shouldn't be an issue in a monospaced context though.

Re: Ligatures in programming fonts

#60
post #22

Earlier quoted context omitted.

The fact that they go on disk is a pro, not a con; and the fact that they're one character not multiple is also a pro and a not a con: what's the point of the individual characters? Those were merely introduces as a necessary workaround to cope with input limitations. Kind of like C trigraphs - and nobody uses those because they want to.

Unicode is a disadvantage for someone who wants to contribute to your code. That person now has to figure out how to write down Unicode arrows, taking her/him out of her/his flow.

Sure, and the Dane has to figure out how to write down ø, taking them out of their flow — until they learn to apply the correct tool for the job.
Post reply on HN