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
49.84k stars 3.06k forks source link

Multiple Fonts/Fallback Fonts #5180

Closed BlueFalconHD closed 3 months ago

BlueFalconHD commented 2 years ago

Check for existing issues

Is your feature request related to a problem?

I really love using Nerd Fonts or Powerline symbols in code to make my simple CLIs feel a little more immersive. I have problems with specific patched Nerd Fonts on MacOS, so I use a font with fallbacks in terminals and other places. The specific fonts I use in these are:

"Symbols Nerd Font Mono",
"Apple Color Emoji",

And this solves my issue in places like Wezterm where there is support for a font with multiple fallbacks.

PS: The font Victor Mono's Nerd Font, either when custom patched or downloaded from the prepatched set, isn't compatible with MacOS, and that is why I use Symbols Nerd Font Mono.

Describe the solution you'd like

I would like to see a font with fallback implementation come to Zed. Maybe just a way to pass in an array to buffer_font_family that uses the first font as the main font like normal. But then any after that would stand in for missing characters that don't exist in the main font.

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

In Wezterm, with my font with fallback configuration set, I get this when running my alias to exa -A --icons (exa is a modern replacement to LS with better colors and icon support).

image

In Zed however, I cannot set a font with fallback, so Zed replaces the characters that don't exist in Victor Mono, my main font, with small unknown icons to show it cannot find that glyph.

image

My proposed solution would make my config look like:

{
    "buffer_font_size": 13,
    "buffer_font_family": ["Victor Mono", "Symbols Nerd Font Mono", "Apple Color Emoji"],
    "autosave": "on_focus_change",
    "vim_mode": true
}

And it would make the output In Zed and Wezterm match.

SilentGlasses commented 1 year ago

I use Victor just fine in Zed editor and terminal. I did install it with Brew tho.

Here's my setup:

brew install font-victor-mono-nerd-font

in settings.conf:

// ~/.config/zed/settings.json
{
    "theme": "One Dark",
    "buffer_font_family": "VictorMono Nerd Font",
    "buffer_font_size": 16,
    "preferred_line_length": 200,
    "terminal": {
        "font_family": "VictorMono Nerd Font",
        "blinking": "off"
    },
    "experiments": {
        "experimental_themes": true
    }
}
BlueFalconHD commented 1 year ago

Quote

PS: The font Victor Mono's Nerd Font, either when custom patched or downloaded from the prepatched set, isn't compatible with MacOS, and that is why I use Symbols Nerd Font Mono.

calebmeyer commented 1 year ago

I have a similar problem, but it's with powerline glyphs:

image

So in addition to fallback fonts, I'd like to see line-height available. Here's the same directory in iterm2:

image
jansol commented 1 year ago

Patching fonts is one option but at least the patched VictorMono Nerd Font Mono from homebrew only provides .ttf files, which are lacking in OpenType feature support (relevant now that you can control those in Zed via the newly added buffer_font_features setting). The vanilla Victor Mono OTOH provides the full set of .otf files with feature controls.

So while a workaround is available, there is still value in having explicit font fallback support.

ondvrsn commented 1 year ago

I am not 100% sure my request belongs to this issue, since I have different reason for requesting Fallback font support. For me, Fallback font support is the first thing to lookup from the document every time I discover new editor or terminal. As a Korean, I use both alphabet and hangul(Korean letters) simultaneously in the editor or terminal, so having option for fallback font is virtually mandatory. To accommodate alphabet and hangul in the same screen, set two different font for each language is the only solution for general purpose. If we could set the fallback font, it will help many asian users who wish to set separate font for their own languages (e.g. Korean, Japanese, Chinese and etc).

BlueFalconHD commented 1 year ago

I am not 100% sure my request belongs to this issue, since I have different reason for requesting Fallback font support. For me, Fallback font support is the first thing to lookup from the document every time I discover new editor or terminal. As a Korean, I use both alphabet and hangul(Korean letters) simultaneously in the editor or terminal, so having option for fallback font is virtually mandatory. To accommodate alphabet and hangul in the same screen, set two different font for each language is the only solution for general purpose. If we could set the fallback font, it will help many asian users who wish to set separate font for their own languages (e.g. Korean, Japanese, Chinese and etc).

This still is the same thing pretty much! I'd love to see this feature come to Zed

muuvmuuv commented 1 year ago

You can try using NerdFonts these are patched with aaaaall icons possible: https://www.nerdfonts.com/