onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

Disable ligatures #374

Closed corelon closed 7 years ago

corelon commented 7 years ago

Hi,

Although I like ligatures for coding with fonts like Fira Code, some other fonts (Space Mono) have ligatures that I would not like to see in the code (e.g. fi). Is it possible to disable ligatures as a setting somewhere?

Many thanks,

Nikos

bryphe commented 7 years ago

Hi @corelon ,

Thanks for trying out Oni and for the feedback!

There is no setting that exists today, ligatures are always on, but I believe this should be relatively straightforward - the ligatures are controlled by a CSS property font-variant-ligatures. So we'd just need to add a config that controls this property: https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures

corelon commented 7 years ago

Hi @extr0py ,

Thank you very much for that.

bryphe commented 7 years ago

Definitely! Thanks for your comments on the PR. I'll reopen this to track more fine-grained control of the ligature support as you suggested.

bryphe commented 7 years ago

I experimented and dug around a bit, and it looks like VSCode implemented this a bit differently: https://github.com/Microsoft/vscode/issues/192

.monaco-editor.enable-ligatures {
    -webkit-font-feature-settings: "liga" on, "calt" on;
    font-feature-settings: "liga" on, "calt" on;
}

I was hoping that this would enable a bit of finer-grained control over the behavior of the ligatures, to exclude some and not others, but it still causes the fi ligature to be rendered via Space Mono. So I tried out with Space Mono, and it doesn't help the situation there.

Looking at Space Mono, the best bet is to disable ligatures for that font via editor.fontLigatures = false. It seems like it is mostly a stylistic font as opposed to a development font.

I'm also tracking some extensibility to this with #412 - having CSS theming support for Oni plugins. With that, a plugin could do some more fine-grained control over text rendering too.

I'll close this for now as I think the best bet for Space Mono is to use editor.fontLigatures false, but feel free to reopen if there is something I missed.