zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
39.42k stars 2.05k forks source link

Only some ligatures are being applied #12176

Open wezm opened 1 month ago

wezm commented 1 month ago

Check for existing issues

Possibly related to https://github.com/zed-industries/zed/issues/11127 but that is specifically about the terminal.

Describe the bug / provide steps to reproduce it

I have enabled ligatures in my settings.json:

  "buffer_font_family": "PragmataPro Mono Liga",
  "buffer_font_features": {
    "calt": true
  },

However only some of the expected ligatures are being applied. For example if I type <!-- it ligates correctly, as does => but != should ligate to and -> to something like but they do not.

These are documented in the font handbook as part of calt as well as shown in other editors.

Environment

Zed: v1.0.0 (Zed Dev 71a94c775b752af59b9be7f41e78afef5e63615e) OS: Linux 1.0.0 (X11) Memory: 62.5 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

These screenshots show the difference in rendering between Zed and JetBrains Rust Rover both using the same font with ligatures enabled.

Zed:

In this one => is ligating but ->, >> in read::<CmapSubtable<'_>>() and // are not.

Screenshot from 2024-05-23 11-00-28

Rust Rover:

Screenshot from 2024-05-23 10-58-04

Zed:

In this one it appears that [[ and ]] are ligating but != is not.

Screenshot from 2024-05-23 11-00-01

Rust Rover:

Screenshot from 2024-05-23 10-59-52

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

JunkuiZhang commented 1 month ago

Linux implementation dose not support font features for now.

wezm commented 1 month ago

Linux implementation dose not support font features for now.

Ahh I see, well I guess this can act as a tracking issue for the implementation. Here's the TODO:

https://github.com/zed-industries/zed/blob/3ec94697b4c3def47209674cf08665fd1674b8ad/crates/gpui/src/platform/cosmic_text/text_system.rs#L198-L204

peppidesu commented 1 week ago

Seems like we need to wait for https://github.com/pop-os/cosmic-text/issues/229 to be resolved