5 ms·
Honest question: Why would you want ligatures in plaintext? Especially in code, wouldn't that be weird as some people tend to manually align their code? Like,
by skytreader 9y ago
Honest question: Why would you want ligatures in plaintext? Especially in code, wouldn't that be weird as some people tend to manually align their code? Like,
modular_raft = 10
spam = 20
The "ft" in modular_raft should convert to a ligature so (I assume) it will then take one character, instead of two. Then developers viewing that source would have different alignments, depending on whether they use Sublime 3 or not.
(EDIT: Formatting.)
- __float 9y agoSome people use monospace fonts with ligatures specific to common programming languages: https://github.com/tonsky/FiraCode https://github.com/tonsky/FiraCode is one such example.
- skytreader 9y agoNice example, thank you. I see how they managed to avoid my issues. (To save people the click: LaTeX ligatures != Fira ligatures. Most Fira ligatures are for programming operators/comparators and they are made to take as much space as the non-ligature version.)
- Shorel 9y agoBoth of these ligatures (fi and ->) in standard computer fonts like TTF or OTF use exactly the same technology. The only difference is that one ligature applies to alphabetic characters and the other to non-alphabetic characters. Ligatures can be used to make some font aesthetically pleasing like this: http://www.impallari.com/lobster/ http://www.impallari.com/lobster/ Or they can be abused like this: https://pixelambacht.nl/2015/sans-bullshit-sans/ https://pixelambacht.nl/2015/sans-bullshit-sans/ It is perfectly possible for a font to have alphabetic and non-alphabetic ligatures.
- Recurecur 9y agoI've been using FiraCode in Idea with ligatures, and like it. It's not a "must have", but I find it more readable and pleasing than using regular fonts.
- pvg 9y agoIt doesn't affect formatting spacing and is mostly for special symbols like arrows, greater than equal, double and triple equalities, etc. The ligatures in question are for programming languages, not stuff like 'ft'.
- giancarlostoro 9y agoThis is my understanding of it as well. The purpose is to DISPLAY two characters as one more clearer to view character, but on GitHub and other places it will still be two independent characters. The purpose is clarity whilst viewing code.
- dahart 9y agoThe monospace font ligatures turn 2 characters into a double-wide single character, so you can still align to your heart's content! https://www.hanselman.com/blog/MonospacedProgrammingFontsWithLigatures.aspx https://www.hanselman.com/blog/MonospacedProgrammingFontsWit...
- apendleton 9y agoBesides fancy programming fonts (which I have mixed feelings about), ligatures and other complex text shaping features can also be necessary for legibly rendering string literals in some non-Latin scripts, like Arabic script. Even if your code is all in Latin letters, you might have test data, UI text, etc., that's in something else.
- wcarss 9y agoThank you for providing this insight -- I'm one of the seemingly rare few who hates ligatures in my Latin-script fonts, and when I saw this submission my brain leapt to "augh, why!?" -- you've given at least one very clear use-case where ligature support is valuable, which I was totally unaware of.
- trumpeta 9y agoThe cool thing about ligatures is that they are a property of the font, not of the text, so I can have a font with ligatures and you can have one without.
- inferiorhuman 9y agoThis was the most recent blurb on HN I've seen about fonts with ligatures for coding: https://news.ycombinator.com/item?id=14821446 https://news.ycombinator.com/item?id=14821446 I've mixed feelings about the idea, but generally seem to like the combination of Atom and Fira Code.
- drivingmenuts 9y agoI've been using Fira Code for a while and having ligatures does make code a bit easier for me to read. I certainly could live without the feature, but if it's there, I'm going to turn it on. Which, ultimately, is what matters. You actually have to turn it on in Jetbrain's editors. It's a decent "no harm, no foul" feature.
- computerex 9y agoI tried to get ligatures to work in gvim for so long because Fira Code looks wonderful with ligatures. Could not make it work :(
- matthewvincent 9y agoI can only speak for me as someone who really loves the aesthetics of code, but there's something super enjoyable about things like arrow functions rendering as actual arrows in Java / JavaScript. It's so clean!
- kpil 9y agoYeah, only that it does that without any context. Ligature mishaps are doubleplus-unclean.
- Shorel 9y agoNot all ligatures work for all syntax files. Therefore the syntax file has something to do with ligatures, therefore it has context.
- mrighele 9y agoI agree, for this reason I don't think it is right to do on a font level. I prefer to use my editor's (emacs) capability to do visual substitutions depending on language that I am using.
- ygra 9y agoEven if monospaced fonts have that ligature, I'm sure they make it as wide as two characters, as the ligature is simply a single glyph representing two characters.
- pjtr 9y agoThis reminds me of elastic tabstops. https://en.wikipedia.org/wiki/Tab_stop#Elastic_tabstops https://en.wikipedia.org/wiki/Tab_stop#Elastic_tabstops Does Sublime Text support those? Any other popular editor? If not, why?
- etatoby 9y agoNo decent editor or IDE supports "proper" elastic tabstops, except for a Visual Studio plugin, I believe. The problem is that it needs the underlying text editor to support different non-uniform tab stops to be configured for every line of code. Few if any text editors support it.
- imron 9y ago> it will then take one character, instead of two No it will still take two characters, but they will be represented by a single glyph.
- coldtea 9y ago>The "ft" in modular_raft should convert to a ligature so (I assume) it will then take one character, instead of two It's not about those kind of ligatures -- but about special programming fonts with programming-oriented ligatures (think >= etc). Those still can affect code alignment, but there are people who are against manual alignment anyway.
- TheRealPomax 9y agoJust because it's "plain text" doesn't mean it has to be monospaced. There are too many other things you can write that aren't "code" for which a good text editor is infinitely preferable to a clunky dedicated GUI application.