jeanguyomarch/eovim

No Ligatures support

Closed this issue · 10 comments

First of all thank you work your work. I'm using the Fira Code font, which provides ligatures i.e. for '=='. Eovim doesn't display ligatures, while e.g.: PHPStorm does.

I looked a little bit around, but I'm not sure what need to be done to fix.

  • eovim --version: eovim 0.1.3.99-25d452f
  • nvim --version | head -n1: NVIM v0.4.3
  • edje_cc --version:Version: 1.23.3

I'm afraid that the GUI widget I'm using (evas textgrid) does not support ligatures :/

From what I understand of ligatures support, the editor should detect by itself pattern such as -> and seamlessly replace it with another text glyph (such as →) for the user to see. Since this is monospaced, the width of the new glyph shall be equal to the sum of the widths of the original pattern (so here, a total width of 2).
This is where evas textgrid gets in the way... it should be able to render (at most) double width characters, but it does not seem to actually be implemented... so it seems that every glyph is always represented with a width of 1...
Unfortunately, evas textgrid is a key component of eovim's UI... so it either needs in-depth patching in core EFL, or be replaced.

Thank you for response. I'm surprised that EFL doesn't provide ligature support in a text widget, I thought it uses harfbuzz, or is my understanding of the problem to shallow and I missed something?

The textgrid can display ligatures (what I understand are just different glyphs, that should span on multiple columns). However, it seems there is no support in the textgrid widget for multiple-width characters.

The textgrid causes each glyph to be rendered on exactly one cell, which causes large glyphs not to be of the appropriate size, and to be tiny. FOr example, in the image attached, you can see that the arrow that should ideally take two columns to "match" the width -> will alway uses only one column.

Screenshot from 2020-04-22 08-09-11

@jeanguyomarch
I think you are testing it wrong. The unicode sign is correctly only 1 char wide. You need to install some NerdFont variant i.e. fira-code. When using a specific font it will replace a '->' with an arrow which is actually two characters wide.

Maybe I'm missing something, but I've tried this with FiraCode, but it yields the same result. I do not think it is the font that makes the substitution. From what I've seen in projects that implement support for automatic ligatures replacement, such as terminal emulators or code editors, it requires explicit support from the program. Here, I think eovim should detect specific patterns such as -> to replace it by a prettier glyph, that the font provides.

My problem with the textgrid is that I cannot use it to render glyphs that span on more than one column, because unfortunately, it does not seem to be implemented. This would not be the first limitation of the textgrid, as it lacks "undercurl" for example.

For details, there is also now a dedicated wiki page

@jeanguyomarch Awesome. Thank you for putting work in to it.

Do I need neovim >4 to use the current HEAD?

Yes indeed, it seems that eovim is currently broken with < 0.4.