tonsky / FiraCode

Free monospaced font with programming ligatures
SIL Open Font License 1.1
76.08k stars 3.07k forks source link

The lack of context sensitivity #182

Open Witiko opened 8 years ago

Witiko commented 8 years ago

The major thing which prevents me from using FiraCode, or any other ligature-based programming font for that matter, is their lack of context-sensitivity. I spend a non-trivial amount of time doing text processing inside the shell and the ligatures tend to garble the output in subtle ways. Most problematic are the visually dissimilar ones (such as != rendering as ≠), which add another layer of mental overhead when reading the output rather than making things simpler. However, I do not think this is an unsurmountable issue:

  1. At the barest minimum, there should be terminal escape sequences for turning the ligatures on and off with the default being the off state. Editors like vim could then only switch the OpenType ligatures on, when they are running. I don't know if there already are such escape sequences (I would honestly be surprised, if there were), but I'm willing to look into this.
  2. After that, the next logical step is for the text editor to switch the ligatures on and off based on the language and the kind of tokens they appear in. This would prevent the ligatures from appearing inside string literals and plain text files.
  3. I don't even know whether OpenType has any support for multiple ligature sets or if it would be necessary to extend it, but making the editor switch between language-specific ligature sets based on the current language (rather than just a coarse-grained on- and off-switching) seems like the logical final step. After this step, I think we might just be quite close to a tangible and robust solution.

This is not really a feature request, but rather a discussion topic.

tonsky commented 8 years ago

You can have all that in any web-based editor, eg Atom or VS Code. Just don't use Fira Code in terminal ;-p

On Fri, Apr 29, 2016, 17:26 Witiko notifications@github.com wrote:

The major thing which prevents me from using FiraCode is its lack of context-sensitivity. I spend a non-trivial amount of time doing text processing inside the shell and the ligatures tend to garble the output in subtle ways. Most problematic are the visually dissimilar ligatures (such as != rendering as ≠), which add another layer of mental overhead, when doing text processing, rather than making things simpler. However, I do not think this is an unsurmountable issue:

  1. At the barest minimum, there should be terminal escape sequences for turning the ligatures on and off with the default being the off state. Editors like vim could then only switch the OpenType ligatures on, when they are running. I don't know, if there are such escape sequences (I would honestly be surprised, if there were), but I'm willing to look into this.
  2. After that, the next logical step is for the text editor to switch the ligatures on and off based on the language and what kind of tokens they appear in. This would prevent the ligatures from appearing inside string literals and plain text files.
  3. I don't even know whether OpenType has any support for ligature sets or if it would be necessary to extend it, but making the editor switch between language-specific ligature sets based on the current language (rather than just a coarse-grained on- and off-switching) seems like the logical final step. After that, I think we would have a tangible and robust solution.

This is not really a feature request, but rather a discussion topic.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tonsky/FiraCode/issues/182

Witiko commented 8 years ago

You can have all that in any web-based editor, eg Atom or VS Code. Just

That is certainly nifty. I did not realize that CSS3 already supports OpenType feature switching (although 3. is not supported there either, is it?)

don't use Fira Code in terminal ;-p

But that's exactly what I'd like to do. :-) Am I out of luck, then?

tonsky commented 8 years ago

Stylistics sets are supported in CSS, but they’re not in the font yet. I’m planning them for the next version.

dhouck commented 7 years ago

Unfortunately, I’m not aware of any terminal emulator which actually supports stylistic sets, so the font supporting them doesn’t help that much for use in the terminal.