Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only some ligatures are being applied #12176

Open
1 task done
wezm opened this issue May 23, 2024 · 14 comments
Open
1 task done

Only some ligatures are being applied #12176

wezm opened this issue May 23, 2024 · 14 comments
Labels
defect [core label] font Font feedback for readability, size, style, etc linux setting Feedback for preferences, configuration, etc

Comments

@wezm
Copy link

wezm commented May 23, 2024

Check for existing issues

  • Completed

Possibly related to #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 71a94c7)
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

@wezm wezm added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels May 23, 2024
@JunkuiZhang
Copy link
Contributor

JunkuiZhang commented May 24, 2024

Linux implementation dose not support font features for now.

@wezm
Copy link
Author

wezm commented May 24, 2024

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:

// todo(linux) handle `FontFeatures`
#[profiling::function]
fn load_family(
&mut self,
name: &str,
_features: &FontFeatures,
) -> Result<SmallVec<[FontId; 4]>> {

@JosephTLyons JosephTLyons added setting Feedback for preferences, configuration, etc font Font feedback for readability, size, style, etc linux and removed triage Maintainer needs to classify the issue admin read Pending admin review labels May 24, 2024
@peppidesu
Copy link

Seems like we need to wait for pop-os/cosmic-text#229 to be resolved

@veryshyjelly
Copy link

Same thing happening in windows

@JunkuiZhang
Copy link
Contributor

Same thing happening in windows

It's a bug introduced by #13854 , and the changes have been reverted via #14045 .

@flyInRust
Copy link

Same thing happening in ubuntu 24.04 zed 0.143.6

1 similar comment
@flyInRust
Copy link

Same thing happening in ubuntu 24.04 zed 0.143.6

@t9t
Copy link

t9t commented Jul 18, 2024

I'm facing this issue as well on Arch Linux using Zed 0.144.3.

@JunkuiZhang and @peppidesu could you explain in short how you came to the conclusion that this is about missing font feature support?

I am asking because some ligatures work fine, while others do not. E.g. as @wezm noted (and as you can see in his screenshot), => works while != does not. Some more examples of working ligatures are ==, :=, <=, and >=. Not working are e.g. ->, -->.

calt is a default font feature, and if I understand https:/zed-industries/zed-fonts/blob/main/params/ligation-set.toml correctly, it should include the not-working != by default (through exeq; i.e. not dependent on font features). Though I may be misunderstanding how default font features work.

image

@JunkuiZhang
Copy link
Contributor

@t9t I implemented font feature support on Windows and macOS. However, it is currently impossible to implement font features on Linux because it uses the cosmic text system, which does not support setting font features. See pop-os/cosmic-text#229

@JunkuiZhang
Copy link
Contributor

Linux uses CosmicTextSystem:

let text_system = Arc::new(CosmicTextSystem::new());

You can see that FontFeatures is not used:

// todo(linux) handle `FontFeatures`
#[profiling::function]
fn load_family(
&mut self,
name: &str,
_features: &FontFeatures,
) -> Result<SmallVec<[FontId; 4]>> {

@t9t
Copy link

t9t commented Jul 18, 2024

Thanks a lot. Let me rephrase my question. I would like to understand how the lack of implementation of font features lead to some ligatures missing, while other ligatures work.

@JunkuiZhang
Copy link
Contributor

I guess this is some kind of default behavior that cosmic text provides?

Sorry I know little about cosmic text.

@andre0xFF
Copy link

Also not seeing ligatures on Ubuntu 22.04.4 LTS zed 0.144.4

@ruskiiamov
Copy link

ruskiiamov commented Aug 11, 2024

same issue
ubuntu 22.04.4
zed 0.147.2
font Fira Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] font Font feedback for readability, size, style, etc linux setting Feedback for preferences, configuration, etc
Projects
None yet
Development

No branches or pull requests

9 participants