kiliman / operator-mono-lig

Add ligatures to Operator Mono similar to Fira Code
MIT License
3.18k stars 201 forks source link

Add "three dashes"/em-dash ligature/kerning pair #12

Closed iStefo closed 6 years ago

iStefo commented 6 years ago

Hi,

I noticed that, e.g. in LaTeX documents, three dashes are displayed "incorrectly" as a double-dash followed by a single dash. Three dashes are sometimes needed in the english language, see https://tex.stackexchange.com/questions/3819/dashes-vs-vs

The following image illustrates the problem:

screen shot 2017-09-18 at 23 30 55

(please ignore the green line below the characters)

Is this something that can be fixed within the font or does the problem originate from a different source?

kiliman commented 6 years ago

The way ligatures work is that it finds the first matching sequence and then substitutes the glyph.

The problem is I have a glyph for hyphen_hyphen, so it matches that and outputs the ligature which are 2 hyphens/dashes pushed together. There are a couple of options:

1) Remove the ligature for hyphen_hyphen (this is actually coming in a future update... ability to customize which ligatures are included in the generated font. see #2)

2) Add a ligature for 3 hyphens... but assume you would want it to either be a long unbroken line, or at least have the hyphens longer. You're always going to have issues with odd numbered hyphens though, so it might be better to go with option 1, if you use the three dashes often.

iStefo commented 6 years ago

Thanks for your explanation. In my case, I would benefit more from having the -- ligature (as I do much more coding than writing) and continuing without the --- ligature if there would be a problem otherwise.

I understand your point that in tex documents, -- and --- should be shown as – and —, respectively, but for programming it is crucial to display the post/pre-decrement as two separate dashes.

I guess this issue can be closed.

kiliman commented 6 years ago

I do plan on adding support for custom ligatures (see #2). You can then create a custom font per language. I know VS code allows you to set the font by file extension. So you could have a font that has ligatures that make sense for LaTeX documents.