Problem
Users of your monospace typeface are politely complaining about ligatures not showing up in Terminal.app (but iTerm2 works fine).
Solution
Use the OpenType contextual alternatives feature instead of standard ligatures and they’ll be forced to show up.
Here’s How
I’m using Glyphs but it should work for any font editor that supports OpenType features.
Step 1: Disable your standard ligatures.
Step 2: Write your contextual alternatives (listed as calt
)
Note that we’re adding a dummy glyph here called LIG that’s just an empty glyph, because we need the cursor in the terminal to function as though there were two glyphs instead of one when we’re replacing, for example, two equals with one equal_equal
ligature. This is how Fira Code does it, as demonstrated in the source code here.
Also note that single quotes in the OpenType syntax denote the substitution target, source here. In other words, sub colon' equal by LIG
means “If you see a colon and an equal together, substitute the colon with the glyph LIG”.
Step 3: Adjust the side bearings of your ligature glyphs
This is what it looks like when we’ve just finished step two.
Adjust the left side bearing of each of your ligatures and you’re done.
Font Cache Problem On MacOs
If after the changes you’ve made the ligatures still aren’t showing up in Terminal.app, it may be due to the operating system caching your font. I recommend changing the name of your font in the testing phase. More solutions here.
Relevant Links
This github issue helped me figure out the solution. Also note that the repo owner ordered a book just for this issue (as far as I can tell), very cool.