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
47.01k stars 2.7k forks source link

Add support for font variation settings #4850

Open macarie opened 1 year ago

macarie commented 1 year ago

Check for existing issues

Describe the feature

When using variable fonts, it's possible to control the weight, spacing, axis, and more.

One way to enable these features on the web is by using the font-variation-settings CSS property.

VSCode has support for this, and it would be cool to also have it in Zed.

Here's a relevant StackOverflow answer that describes the behavior and differences with font features: VS Code: behavior of "editor.fontLigatures" and "editor.fontVariations"?.

Also relevant mdn page: Variable fonts guide.

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

I imagine it working like buffer_font_features, so something like:

{
  "buffer_font_variations": {
    "wght": 250,
    "wdth": 87.5
  }
}
Setting the `wght` variation: ![image](https://user-images.githubusercontent.com/48020855/229279456-12ffc343-0513-4743-a07e-d5f2221f202e.png) ![image](https://user-images.githubusercontent.com/48020855/229279493-53d99c3a-d92c-4abe-b26f-2ee4bf393e31.png)
Setting the `wdth` variation: ![image](https://user-images.githubusercontent.com/48020855/229279609-098654f9-9f42-4f32-81d1-265dcce8ac49.png) ![image](https://user-images.githubusercontent.com/48020855/229279633-6f21d563-c016-41cb-bf39-f0d8e8214433.png)
Setting both at the same time: ![image](https://user-images.githubusercontent.com/48020855/229279666-13f437e0-30fd-427d-84c9-8e01fac45334.png)
iamnbutler commented 1 year ago

This will be really nice (someday), but sadly we have a hard limitation in the tech we use for rendering fonts that won't allow us to use variable font properties.

Someday we will resolve this, but I can almost certainly guarantee it won't be soon.

I feel you on this, I'd love this as well.