zed
zed copied to clipboard
Support Font Weight Variation
Check for existing issues
- [X] Completed
Describe the feature
When setting font, it would be nice to be able to set the weight variation as well..
If applicable, add mockups / screenshots to help present your vision of the feature
I don't have a screenshot but, as it is right now we can only call the font:
"buffer_font_family": "VictorMono Nerd Font",
but it would be nice to be able to set the following:
"buffer_font_family": "VictorMono Nerd Font Light",
You can do this, it's not super obvious though. Try adding the weight name after the font name, like this:
I did but it did not change the font, just made things weird with spacing...
These two are lined up properly when not using the variant...
Here's the config without the extra variant:
Here it is after
not sure if this matters but I did install the font from brew:
brew install --cask font-victor-mono-nerd-font
Seeing this in the log:
02:58:16 [ERROR] could not find a non-empty font family matching one of the given names
02:58:26 [ERROR] could not find a non-empty font family matching one of the given names
02:59:51 [ERROR] could not find a non-empty font family matching one of the given names
You can do this, it's not super obvious though. Try adding the weight name after the font name, like this:
Can confirm, mentioning the weight after the font name doesn't work. Zed version is 0.75.2
You might need to try a few things. Usually if you open Font Book and use Family Name + Style Name it will work. It doesn't seem you can manually specify an italic weight however (we drive this from the theme.)


Usually if you open Font Book and use Family Name + Style Name it will work.
It will work for some fonts, and won't for some others, I haven't been able to find a clear pattern. I was able to select variants of Iosevka following this method, for example, but JetBrains Mono completely refuses to work, same for Fira Code. And Postscript names do not work either.
This seems like it's still not working on 115.3 preview. Which makes me think that the font script variant issue is related as the font uses the italic variant for this.
https://www.monolisa.dev/faq#the-script-variant-doesnt-work-what-can-i-do
I even checked to make sure the font I'm using supports it using: https://fontdrop.info/#/?darkmode=true
I want to enable script variant on my font and I can't seem to make it work even with "ss02" = true
set. Do I need to add additional settings to it, like textMateRules?
ZED Config: liga and zero options are working fine
"buffer_font_family": "Monolisa",
"buffer_font_features": {
"liga": true,
"zero": true,
"ss02": true
}
In vscode I need to set extra settings like:
"editor.fontFamily": "MonoLisa",
"editor.fontLigatures": "'ss02' on",
"editor.tokenColorCustomizations":
{
"textMateRules": [
{
"scope": [
// following will be in italic
"comment",
"entity.name.type.class", //class names
"keyword", //import, export, return…
"constant", //String, Number, Boolean…, this, super
"storage.modifier", //static keyword
"storage.type.class.js", //class keyword
],
"settings": {
"fontStyle": "italic"
}
},
{
"scope": [
// excluded from italics (VSCode has some defaults for italics)
"invalid",
"keyword.operator",
"constant.numeric.css",
"keyword.other.unit.px.css",
"constant.numeric.decimal.js",
"constant.numeric.json"
],
"settings": {
"fontStyle": ""
}
}
]
}
I did try it with both, static and variable font!
This was working for me until I updated to 0.119.19. I used to be able to set "buffer_font_family": "Operator Mono Book"
, but now it only accepts "Operator Mono"
and does not allow me to select the font weight / style.
This was working for me until I updated to 0.119.19. I used to be able to set
"buffer_font_family": "Operator Mono Book"
, but now it only accepts"Operator Mono"
and does not allow me to select the font weight / style.
@osiewicz this is probably a side effect of the work you were doing. Want to take a peek?
My bad, "Operator Mono Book"
does work, but I get a yellow squiggly because it fails validation. Styles with multiple words don't seem to work, like "Operator Mono Book Italic"
Note: at least in the code names, we seem to deal with the "family name" only: https://github.com/zed-industries/zed/blob/f7a2118b159ac98a4fda8f15974090781522b407/crates/gpui/src/platform/mac/text_system.rs#L52
While Bold
, Italic
, etc. are not really names and that's why we might not be resolving it anymore.
There's been a recent change in the settings file completions that removed such options completion in the settings, but those are not affecting the resolution of these.
@SomeoneToIgnore I need to object, at least a little.
Style names like Bold
and Italic
might not be part of the font name but I have some fonts that have styles like Thin
and UltraLight
. In my case Zed selects the Thin
or UltraLight
style instead of Regular
(this is an assumption based on how Zed looks using this font in comparison to other editors) which makes this font unusable. So providing the user a possibility to help Zed chose which style to use for Bold
, Italic
, Bold Italic
and Regular
would be a big improvement.
I have nothing against providing these, we should do that. My take was supposed to mean "current Zed seems to have zero mechanisms to look up a font by the family name AND the style"
Previously, completions allowed to input these style variants right in the font family setting which was incorrect: all those style variants I checked during https://github.com/zed-industries/zed/pull/4205 did not work for me.
So, what we need now:
- a better approach to the settings, so we can set both a family name and a style (in separate settings entries, presumably, as VSCode does that?)
- a better approach to settings style retrieval and completions (as the aforementioned PR reverted font style retrievals for completions)
- a code that actually reads those values and applies them correctly
Feel free to use that PR for the reference and ask for more clarifications, if needed. I can also pair on that in any channel during UTC+2 hours.
As for me - it works but I get a warning message that font name is not in list:
info: version: 0.119.21 hash: ca60f0972bd959afab164f88d5c15074fe76892c
Hey, same problem in my case. ;) A simple settings with the font style will be nice to have :)
A simple settings with the font style will be nice to have :)
And a way to reference it in a theme, if it doesn't already exist? (I have not dug into the theme spec at all)
Any progress on this? I love this editor, but I really miss my favorite "Operator Mono Book", which doesn't work for me at all.
@sgttwld
Any progress on this? I love this editor, but I really miss my favorite "Operator Mono Book", which doesn't work for me at all.
In Zed 0.126.3, specifying the variant in lowercase worked for me; e.g.
{
"buffer_font_family": "Operator Mono book",
}
(or in my case Operator Mono SSm Lig book
).
Love Zed but missing this sorely :)