firenvim icon indicating copy to clipboard operation
firenvim copied to clipboard

Ligature support

Open musjj opened this issue 2 years ago • 2 comments

It would be nice if ligature can be supported. I'm using JetBrainsMono and ligatures work just fine on GitHub code blocks. But it's not working inside firenvim.

musjj avatar Jun 15 '23 00:06 musjj

I'm not sure if this is possible to do in a generic and efficient way for Firenvim. Firenvim has no actual knowledge of the font being used and I don't know of any canvas APIs that would check if a pair of characters would be rendered with ligatures. The only solution I can think of is to render each pair of characters first "normally" and then twice by changing the second character of the pair and comparing whether the results are pixel-for-pixel identical. It also asks some interesting questions about what neovim highlights should be used to render ligatures when the underlying cells have different highlight ids.

glacambre avatar Jun 15 '23 05:06 glacambre

I don't know about the Canvas interface issues. Just a couple random thoughts even though I don't feel any need for this personally...

  • You'll probably need to bundle and call out to an actual shaping engine to get this right: for example Harfbuzz can now be compiled to WASM.
  • As for syntax highlighting issues, I'm guessing you never want to ligature across a highlight group boundary.
  • There are other NeoVIM interfaces that support ligatures, for example Neovide. It is probably worth reviewing their implementations.

alerque avatar Jun 15 '23 06:06 alerque