News for hackers. Stuff that matters.
Re:Modern Mono by samwillis on Monday February 13, 2023 @02:51PM (#34779276)
I really don't get the current trend of font ligatures for things such as !=. It seems to me you loose the fundamental structure of the code. I get it looks good in screen shots on Twitter but when I tried a font with them it just seems to make me have to pause and think more.

What have others experience been?

Re:Modern Mono by c0l0 on Monday February 13, 2023 @03:40PM (#34780084)
Yes!! I would so like to have a fontconfig option to just disable ligatures altogether, but afaik, one would have to enumerate ALL fonts that one would like to disable them for in the config file - and that's not feasible. So I mostly live with it, and shake my fist in helpless anger whenever somethings f_cks up my otherwise beautifully monospaced flow with this most damned misfeature of digital typesetting.
Re:Modern Mono by capableweb on Monday February 13, 2023 @03:01PM (#34779452)
Agree with you, tried it a couple of times and found it more distracting than anything. One gripe is seeing one character, hitting backspace and instead of removing one character, it changes to another character rather than deletes it ("≠" -> hitting backspace expecting "" but instead seeing "!" now).
Re:Modern Mono by guessmyname on Monday February 13, 2023 @03:22PM (#34779794)
Font ligatures are the exact opposite of WYSIWYG [1] in the plain/text world.

I want to ensure that every character I see on the screen (at least in my code editor) is exactly what it is supposed to be, and maybe that way, I can avoid a good portion of character-based security issues like IDN homograph attacks [2] and bidirectional Unicode vulnerabilities [3]. Font ligatures can also conceal certain characters, such as the dot (.) used in domain names, making it easier for attackers to carry out phishing and domain spoofing attacks.

That is why I will never use font ligatures for anything serious.

The only scenarios where font ligatures make sense to me is in mathematical papers.

[1] https://en.wikipedia.org/wiki/WYSIWYG

[2] https://en.wikipedia.org/wiki/IDN_homograph_attack

[3] https://github.blog/changelog/2021-10-31-warning-about-bidir...

Re:Modern Mono by okramcivokram on Monday February 13, 2023 @03:09PM (#34779599)
I love them and use them everywhere I can, mostly with JS/TS. I find the code displayed with ligatures more readable, and the only time I notice any overhead is when modifying === to !== or back, when I have to remember that I have to change only the initial character. Having => as arrows instead of `equals+more than` is enough of improvement, for me, that I keep using them, even without all other tiny tweaks that they give you.

I used to use "Fira Code", but then I've migrated to "JetBrains Mono" everywhere.

Re:Modern Mono by masklinn on Monday February 13, 2023 @03:02PM (#34779466)
I love ligatures. I find that well crafted ones make code look more coherent without detracting in any way from the structure (unlike proportional fonts which I abhor).

They're also very useful for languages which have operators which are easy to confuse, like the triple equal of PHP and JS (in which case having a ligature that's really distinct from the double equal is very convenient).

Re:Modern Mono by capableweb on Monday February 13, 2023 @05:46PM (#34782028)
Monospace font on HN seems to do good enough, at least for me, or you think these are too similar as well?

    ==
vs

    ===
On my machine(s), the difference is quite obvious, with the space in-between each equal sign and all.
Re:Modern Mono by WorldMaker on Tuesday February 14, 2023 @02:23PM (#34794579)
The difference is obvious when paired together next to each other like that, but the issue with code is often you are looking at examples (often with weary eyes) that are "miles apart" or the only one in a file and trying to spot the difference.

The ligatures that stack a third bar vertically across the space of three characters do jump out at you as much more meaningfully distinct in isolation. You don't have to just count width or whitespace, you have a third "clue" to work with, and sometimes that extra "clue" is incredibly important when you are tired and staring a bunch of code you expected to work and has a subtle bug and need to visually spot the subtle bug.

Re:Modern Mono by neilpanchal on Monday February 13, 2023 @03:38PM (#34780040)
We wrote extensively about ligatures, pros and cons: https://berkeleygraphics.com/public-affairs/bulletins/BT-001...

Personally, I generally agree with you - ligatures add a layer of ambiguity. Toyed around with the idea of "precision ligatures", but it only works a subset of ligatures.

It's important to keep in mind that ligatures are at the presentation layer, i.e. when the glyphs are drawn. You can still copy and paste the text, underlying representation is still individual chars. Also, ligatures are optional, so why not; a lot of people love them.

Re:Modern Mono by lionkor on Tuesday February 14, 2023 @12:55AM (#34785956)
Slightly off-topic, but why does your site not work in Russia? I'm currently in Russia visiting family, and need to turn a VPN on just for you, as anything else I use works perfectly fine. I sure hope it's not politics, because the last thing I need is fonts to be politically charged.
Re:Modern Mono by mmgutz on Monday February 13, 2023 @04:06PM (#34780476)
'===' and '==' in JavaScript code were too similar. Maybe that's been addressed by different glyphs in other fonts, but that was enough to say no.
Re:Modern Mono by WorldMaker on Tuesday February 14, 2023 @02:26PM (#34794613)
Fira Code and Cascadia Code add an entire third "bar" vertically to the triple equals. It may be subtle at first, but eventually it becomes a massively useful difference.
Re:Modern Mono by Finnucane on Monday February 13, 2023 @04:13PM (#34780609)
It seems like a little bit weird to have ligatures in a monospaced font. The whole reason ligatures exist is so that bits of letterforms in closely-spaced type don't crash. That shouldn't happen in a monospace font. If you're just changing the space so that two characters are grouped as a kind of unit, that to me defeats the purpose of using monospace to begin with.
Re:Modern Mono by xigoi on Wednesday February 15, 2023 @03:26PM (#34810062)
The point of using monospace is to make things align. Ligatures don't defeat that.
Re:Modern Mono by twblalock on Monday February 13, 2023 @04:35PM (#34780956)
The ligatures are hipsterism and it needs to stop. I've never seen it happen in a professional setting.
Re:Modern Mono by naikrovek on Monday February 13, 2023 @08:50PM (#34784052)
agree; I don't like it when my computer lies to me about what character is there, and ligatures are designed to do just that.
Re:Modern Mono by xigoi on Wednesday February 15, 2023 @03:27PM (#34810086)
On the other hand, I hate when a programming language lies to me. Why have != when it should really be ≠?
Re:Modern Mono by naikrovek on Wednesday February 15, 2023 @10:52PM (#34814776)
because it isn't "≠", it's "!=". that's what the compiler accepts in most/all languages I know.

show me a keyboard made today that can enter that character directly. that character can't be entered directly because the USB-HID spec doesn't specify a keycode for that character.

I understand that some people want their computer programming languages to look like APL but we tried that, and it failed. Fortunately or unfortunately.

Re:Modern Mono by xigoi on Thursday February 16, 2023 @12:33AM (#34815448)
It's written "!=" due to physical limitations, yes, but it means "≠". That's why I want to see it that way.
Re:Modern Mono by naikrovek on Thursday February 16, 2023 @11:46PM (#34830901)
I understand your point, I didn't make that clear.

!= and ≠ are merely visual representations of a concept, so I understand and agree that preference matters here.

the bytes in the file are the Unicode code points for "!" and "=", and that's what the compilers and parsers of the world care about, so that's what I want to see.

I don't want my text editor lying to me about the contents of the file. one could argue that showing ≠ does indeed tell you that "!=" is in the file. it will also appear if the Unicode code point "≠" is in the file. you may see the nice symbol you want to see, but the compiler or interpreter will not understand that and will show you an error which you may or may not immediately recognize as the wrong thing.

I want my text editor to show me what is actually present in the file.

Re:Modern Mono by Accacin on Tuesday February 14, 2023 @04:53AM (#34787383)
I generally don't care, I don't find code easier or harder to read.

I do dislike when you go to delete a font ligature and it reverts back, as you expect to delete one character.

Re:Modern Mono by thworp on Tuesday February 14, 2023 @06:30AM (#34787951)
Since an editor setup is very personal, it doesn't really matter if other people can't immediately recognize that the ligature is == or != . Personally I love ligatures and find that they help me to immediately grasp code structure since they are unique glyphs. Without them there is a slight delay when scanning things and your brain needs to do lookahead and lookbehind to be sure -> isn't just > or the ! in != isn't a random not.
Re:Modern Mono by WorldMaker on Tuesday February 14, 2023 @02:35PM (#34794736)
I'm a big fan of ligatures and it is now a "must have" when choosing a coding font for me.

The "fundamental structure of the code" doesn't change, all those same mostly-ASCII code points are there unchanged. (Copy and paste still works. Source control works, obviously.) It's just a presentation thing.

There's also an argument (often used most especially by Functional Programming proponents and languages) that the "fundamental structure of the code" is actually the math behind the code and our mostly-ASCII assortment of programming language symbols are the easier-to-type/encode/transmit compromise of the mathematical fundamentals. From that perspective, ligatures are more "fundamental" by better expressing their mathematical underpinnings than the raw text that describes them.

> it just seems to make me have to pause and think more

A classic Python mantra is that "code is read far more often than it is written". If it might be a little slower to write, but it speeds up reading comprehension, that alone can be a major productivity win, per that mantra.

Of course, I think there's a familiarity thing at play here, too. Just like most things we learn, there's an early learning curve where it seems harder to work with something like ligatures because you are unfamiliar with them, but eventually you gain familiarity and are just as fast writing it as you were before.