wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.67k stars 745 forks source link

Fonts are different compared to other terminals #5331

Closed rwxmad closed 4 months ago

rwxmad commented 4 months ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

wezterm 20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

With this configuration, wezterm font is completely different compared to Alacritty, its similar to:

3774, #689

local wezterm = require("wezterm")

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

config.automatically_reload_config = true

config.front_end = "WebGpu"

-- Window
config.window_decorations = "RESIZE"
config.window_background_opacity = 0.95
config.window_padding = {
  left = 2,
  right = 2,
  top = 2,
  bottom = 2,
}

config.hide_tab_bar_if_only_one_tab = true

-- Font
config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })
-- config.font_locator = "ConfigDirsOnly"
-- config.font_dirs = { os.getenv("HOME") .. "/dotfiles/fonts/BlexMono/ttf" }
-- config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })

config.font_size = 12.0

config.freetype_load_target = "HorizontalLcd"

-- Colorscheme
config.color_scheme_dirs = { os.getenv("HOME") .. "/.config/wezterm/colors" }
config.color_scheme = "Solarized"

config.bold_brightens_ansi_colors = true

return config

Alacritty: image Wezterm: image

I try tune many options, but anyway don't have same result as in alacritty. Like in #689, i try to specify font directory:

local wezterm = require("wezterm")

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

config.automatically_reload_config = true

config.front_end = "WebGpu"

-- Window
config.window_decorations = "RESIZE"
config.window_background_opacity = 0.95
config.window_padding = {
  left = 2,
  right = 2,
  top = 2,
  bottom = 2,
}

config.hide_tab_bar_if_only_one_tab = true

-- Font
-- config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })
config.font_locator = "ConfigDirsOnly"
config.font_dirs = { os.getenv("HOME") .. "/dotfiles/fonts/BlexMono/TTF" }
config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })

config.font_size = 12.0

config.freetype_load_target = "HorizontalLcd"

-- Colorscheme
config.color_scheme_dirs = { os.getenv("HOME") .. "/.config/wezterm/colors" }
config.color_scheme = "Solarized"

config.bold_brightens_ansi_colors = true

return config

But i get an error:

Unable to load a font specified by your font=wezterm.font('BlexMono Nerd
Font', {weight="Medium", stretch='Normal', style=Normal}) configuration.
Fallback(s) are being used instead, and the terminal may not render as
intended. An alternative variant of the font was requested; TrueType and
OpenType fonts don't have an automatic way to produce these font variants, so
a separate font file containing the bold or italic variant must be installed.
See https://wezfurlong.org/wezterm/config/fonts.html for more information

Unable to load a font specified by your font=wezterm.font('BlexMono Nerd
Font', {weight="Medium", stretch='Normal', style=Normal}) configuration.
Fallback(s) are being used instead, and the terminal may not render as
intended. An alternative variant of the font was requested; TrueType and
OpenType fonts don't have an automatic way to produce these font variants, so
a separate font file containing the bold or italic variant must be installed.
See https://wezfurlong.org/wezterm/config/fonts.html for more information

My Alacritty config:

live_config_reload = true

[env]
TERM = "alacritty"

[window]
opacity = 0.95
decorations = "None"
padding = { x = 2, y = 2 }

[scrolling]
history = 10000

[font]
size = 12.0

[font.normal]
family = "BlexMono Nerd Font"
style = "Medium"

[font.bold]
family = "BlexMono Nerd Font"
style = "Bold"

[font.italic]
family = "BlexMono Nerd Font"
style = "Medium Italic"

[font.bold_italic]
family = "BlexMono Nerd Font"
style = "Bold Italic"

[colors]
draw_bold_text_with_bright_colors = true

[colors.primary]
background = "0x001217"
foreground = "0x708183"

[colors.normal]
black = "0x002b36"
blue = "0x268bd2"
cyan = "0x2aa198"
green = "0x859900"
magenta = "0xd33682"
red = "0xdc322f"
white = "0xeee8d5"
yellow = "0xb58900"

[colors.bright]
black = "0x002b36"
blue = "0x839496"
cyan = "0x93a1a1"
green = "0x586e75"
magenta = "0x6c71c4"
red = "0xcb4b16"
white = "0xfdf6e3"
yellow = "0x657b83"

[cursor]
vi_mode_style = {blinking = "Always"}

[keyboard]
bindings = [
  { key = "q", mode = "Vi", action = "ToggleViMode" },
]

To Reproduce

Case with default font specified:

local wezterm = require("wezterm")

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

config.automatically_reload_config = true

config.front_end = "WebGpu"

-- Window
config.window_decorations = "RESIZE"
config.window_background_opacity = 0.95
config.window_padding = {
  left = 2,
  right = 2,
  top = 2,
  bottom = 2,
}

config.hide_tab_bar_if_only_one_tab = true

-- Font
config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })

config.font_size = 12.0

config.freetype_load_target = "HorizontalLcd"

-- Colorscheme
config.color_scheme_dirs = { os.getenv("HOME") .. "/.config/wezterm/colors" }
config.color_scheme = "Solarized"

config.bold_brightens_ansi_colors = true

return config

Case with custom font dir:

local wezterm = require("wezterm")

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

config.automatically_reload_config = true

config.front_end = "WebGpu"

-- Window
config.window_decorations = "RESIZE"
config.window_background_opacity = 0.95
config.window_padding = {
  left = 2,
  right = 2,
  top = 2,
  bottom = 2,
}

config.hide_tab_bar_if_only_one_tab = true

-- Font
config.font_locator = "ConfigDirsOnly"
config.font_dirs = { os.getenv("HOME") .. "/dotfiles/fonts/BlexMono/TTF" }
config.font = wezterm.font("BlexMono Nerd Font", { weight = "Medium" })

config.font_size = 12.0

config.freetype_load_target = "HorizontalLcd"

-- Colorscheme
config.color_scheme_dirs = { os.getenv("HOME") .. "/.config/wezterm/colors" }
config.color_scheme = "Solarized"

config.bold_brightens_ansi_colors = true

return config

Configuration

like in reproduce section

Expected Behavior

Font is displayed completely differently than in other terminals, in particular as in Alacritty with the same settings

Logs

No response

Anything else?

No response

lachesis commented 4 months ago

I'm also impacted by this. Alacritty's rendering of the font looks much better than WezTerm's to me. I'm on ArchLinux X11.

In #2927, it was suggested to use:

config.front_end = "WebGpu"

This does result in a better looking font for me but it still doesn't look quite right. Now it is bolder but a bit more smeared. I don't understand what Alacritty is doing differently but I like it much better.

rwxmad commented 4 months ago

This does result in a better looking font for me but it still doesn't look quite right. Now it is bolder but a bit more smeared. I don't understand what Alacritty is doing differently but I like it much better.

Absolutely agree, this is the only reason why I can't migrate from Alacritty to wezterm :(

wez commented 4 months ago

Fonts appearance is a highly subjective topic; there are thousands of users that are happy with how the fonts appear. That doesn't mean that you are wrong, just that you find different things more important in how you perceive text.

wezterm uses freetype on all operating systems for consistency and sanity in implementation and maintenance. That makes its rasterization different from most other software that uses the macOS font renderer, because it is a different renderer.

I am not going to make wezterm use the macOS renderer.

I've exposed just about every knob and option that is possible to expose from freetype to allow users to dial in their preference, but it is admittedly a complex topic.

I do not have time to troubleshoot and dial in all the configs of every user that has questions about this, so I'm sorry to say that I'm going to close this issue without spending more time on it. It's not that I don't care, or don't think that it is important to you, but rather that there isn't anything for me to fix and working through these sorts of issues is incredibly time consuming and frustrating, and I get nothing out of the experience.

If you feel that you have to use alacritty as a result, that is fine by me: you've got to do what you've got to do.

piersolenski commented 3 months ago

It's subjective from an aesthetic point of view, but from an accessibility one, I find this frustrating as someone without great vision. I love everything about this terminal, and yet it's the one thing that's is the one thing stopping me from switching over 😓 https://github.com/wez/wezterm/issues/3774#issuecomment-1791730581 is a real strain on my eyes compared to other terminals, even after dialling every knob 😅 I suppose I will just have to pray for sixel support in Alacritty one day 🙏

github-actions[bot] commented 2 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.