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

Can't set font features and variations #229

Open
CryZe opened this issue Feb 8, 2024 · 9 comments
Open

Can't set font features and variations #229

CryZe opened this issue Feb 8, 2024 · 9 comments

Comments

@CryZe
Copy link
Contributor

CryZe commented Feb 8, 2024

At the moment it's not possible to set any font features (kerning, alternates, ligatures, capitals, tabular nums, ...) nor can you set any variation axis.

@narodnik
Copy link

See here for examples of OTF font features:

https://rsms.me/inter/#features

@peppidesu
Copy link

Hi, is anyone working on this as we speak? I would contribute but I am afraid I might lack the knowledge to do so.

@jackpot51
Copy link
Member

This is an issue I am interested in working on, but still need some more information on how it would be used by users of cosmic-text.

@t9t
Copy link

t9t commented Jul 18, 2024

@jackpot51 Do you think it could be helpful to look at the Zed editor code? It implements font features for Mac and Windows, but not yet for Linux (using cosmic-text). Perhaps by analyzing how it does it for Mac and Windows, and how it uses cosmic-text for Linux, you can get an idea of how it could be used? It seems like a perfect showcase with ample comparison material.

The primary cosmic-text usage seems to be here: https://github.com/zed-industries/zed/blob/main/crates/gpui/src/platform/cosmic_text/text_system.rs

The Mac implementation of font features is around here: https://github.com/zed-industries/zed/blob/f15a441c9d78c9687c1400d14c8a7991fb6db08a/crates/gpui/src/platform/mac/text_system.rs#L230

The Windows DirectWrite implementation of font features is here: https://github.com/zed-industries/zed/blob/f15a441c9d78c9687c1400d14c8a7991fb6db08a/crates/gpui/src/platform/windows/direct_write.rs#L295

The code is a bit hard to follow for me, a Rust novice and zero experience with font rendering or the Zed codebase. But I think taking some time browsing the code could give some hints as to how font features could fit in the cosmic-text usage in the Zed codebase. I was primarily looking at the different implementations of PlatformTextSystem.

Alternatively of course, someone from the Zed team might be able to assist. I entered this rabbit hole via: zed-industries/zed#12176

@Jackaed
Copy link

Jackaed commented Sep 24, 2024

Did this end up going anywhere? I'm also going down the zed rabbit hole, and this issue seems to have gotten stale.

@Xori71
Copy link

Xori71 commented Oct 19, 2024

Hopefully it will get worked-on. Zed on Linux is kinda crippled right now for users using ligatures.

@jackpot51
Copy link
Member

It is likely we will be using variable fonts for COSMIC soon, and that will involve implementing this. I have not yet researched the requirements.

@Xori71
Copy link

Xori71 commented Oct 19, 2024

It is likely we will be using variable fonts for COSMIC soon, and that will involve implementing this. I have not yet researched the requirements.

Oh, that’s pretty cool. Take your time with this, and thanks for your time.

@drewcrawford
Copy link

Thanks for pointing me to this issue.

My understanding is that zed (along with several other users of advanced text features including myself) rely on the builtin platform text engines at the moment. Those would be CoreText on macOS, GDI/DirectWrite/etc. on Windows or – to the extent anything can be considered builtin on Linux – pango (which primarily leans on harfbuzz). Of these, only the latter is open source.

That would place the head of the rabbit trail about here: harfbuzz/harfbuzz#2123, which has self-contained programs for rendering opentype features that aren't just calling a proprietary text engine to do it all for us.

I am also generally aware of its rust port. I'm not entirely sure what its status is on the OpenType features but seems to support a subset of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants