Ligature rendering seems to only partially work


#1

Hi,

I’m trying to get ligature to work in Atom, using the Haskliq font. I’m using Atom 1.3.2 and have this in my styles.less:

atom-text-editor {
  text-rendering: optimizeLegibility;
}

When I view a Haskell file, I see the ligature for “->”, but for “<-”, sometimes I get ligature and sometimes just ‘<’ and ‘-’. When I view C++, I can’t find any ligature.

When I switch to the Monoid font, I can see some ligatures in C++ but Haskell is still spotty.

How do ligatures work under the hood in Atom? How is it decided whether a sequence of characters should be rendered as a particular ligature? Does it depend only on the font? Does Atom decide? Can plugins interfere?


#2

I notice that the same code snippet pasted into a .txt file and into a .hs file get different ligature treatment. The .txt ironically gets better treatment. I got suspicious and did some package investigation.

It turned out that if I turn off haskell-grammar, I get better, apparently normal, ligature. So, it seems to suggest that packages/plugins can affect/interfere with ligature.

I suppose the next question is how and how to prevent unwanted interference.


#3

See atom/atom#9372 (comment)


#4

I think it has to do with how the grammar tokenizes the input. I remember there were changes to the language-javascript package specifically to improve ligature rendering; e.g.

haskell-grammar might need the same