Emojis are not rendered correctly (size and baseline)
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
20230712-072601-f4abf8fd
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
No, and I'll explain why below
Describe the bug
When rendering emojis using Apple Color Emoji font, WezTerm doe not align the emoji as well as iTerm2, for example.
Here is the result in iTerm2
And here is the size in WezTerm:
Notice that the baseline of the emojis are not aligned with the text. It seems that the issue can be fixed if we can increase the emoji size.
To Reproduce
- Use Apple Color Emoji as a fallback font.
- Write text with emojis in a text editor.
- Compare the size and baseline with iTerm2.
Configuration
local wezterm = require 'wezterm'
local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.allow_square_glyphs_to_overflow_width = "Always"
config.cell_width = 0.9
config.color_scheme = "iTerm2 Default"
config.colors = {
cursor_bg = "#C7C7C7",
cursor_fg = "#FFFFFF",
cursor_border = "#C7C7C7",
}
config.cursor_thickness = "2px"
config.font = wezterm.font_with_fallback({
{ family = "JetBrains Mono", weight = "DemiBold" },
{ family = "Apple Color Emoji" },
{ family = "Symbols Nerd Font" },
})
config.font_size = 14
config.line_height = 1.02
config.window_decorations = "INTEGRATED_BUTTONS | RESIZE"
return config
Expected Behavior
The emojis should be rendered with the baseline and size matching the main font.
Logs
No response
Anything else?
No response
By the way, I tried to change the scale option, but It had no effect in the emojis.
I too am looking for guidance on this one, if only to get info on enlarging just this one emoji. (top wezterm, bottom iTerm)
wezterm ls-fonts --text 🐳
LeftToRight
0 🐳 \u{1f433} x_adv=12.395786047162193 cells=2 glyph=u1F433,1038 wezterm.font("Apple Color Emoji", {weight="Regular", stretch="Normal", style="Normal"})
I found info on 342, but config.allow_square_glyphs_to_overflow_width has no effect on emojis, and tuning the dpi like config.dpi = 90.0 may work, but only for one screen. Users with multi-monitors, when the monitors have a different dpi, will have unusably small or large text when viewing on the other monitor.
I switched back to kitty because of this bug. Which is a shame, because I much prefer using Lua for configuration and wezterm actually seems to support Monaspace properly.
Not sure if this belongs here or warrants its own issue, but I noticed that emojis aren't correctly aligned horizontally either, they seem a bit too far to the left. For example with the string [💩]:
| Wezterm | Tilix |
|---|---|
This is on Linux/X11 using Noto Color Emoji. I played around with allow_square_glyphs_to_overflow_width and dpi but they don't seem to have any effect on this.