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

matched incorrect Iosevka family on macOS #1630

Closed lithammer closed 2 years ago

lithammer commented 2 years ago

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

macOS

WezTerm version

20220208-064631-dbf190d4

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

Some unicode glyphs are overlapping, for example ✚28…8:

Screenshot 2022-02-09 at 13 41 57
$ wezterm ls-fonts --text "✚28…8"
✚28…8 \u{271a}\u{32}\u{38}\u{2026}\u{38} glyph=19538 wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                             /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
✚28…8 \u{271a}\u{32}\u{38}\u{2026}\u{38} glyph=21   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                             /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
✚28…8 \u{271a}\u{32}\u{38}\u{2026}\u{38} glyph=27   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                             /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
✚28…8 \u{271a}\u{32}\u{38}\u{2026}\u{38} glyph=18911 wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                             /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
✚28…8 \u{271a}\u{32}\u{38}\u{2026}\u{38} glyph=27   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                             /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText

To Reproduce

$ echo "✚28…8"
✚28…8

Configuration

local wezterm = require("wezterm")

return {
  font = wezterm.font_with_fallback({
   "Iosevka",
    "Apple Color Emoji",
  }),
  font_size = 14,
  force_reverse_video_cursor = true,
  window_padding = {
    left = "1cell",
    right = "1cell",
    top = "0.5cell",
    bottom = "0",
  },
}

Expected Behavior

I expect the unicode cross and the ellipsis chars to no overlap with surrounding text.

Logs

13:46:34.042 INFO wezterm_gui::termwindow > OpenGL initialized! Intel(R) Iris(TM) Plus Graphics 645 4.1 INTEL-18.4.6 is_context_loss_possible=false wezterm version: 20220208-064631-dbf190d4

Anything else?

This is how Kitty renders the same glyphs:

Screenshot 2022-02-09 at 13 49 11
wez commented 2 years ago

Can you confirm which wezterm version you are running? The wezterm ls-fonts output is not consistent with the version you wrote above.

lithammer commented 2 years ago

Can you confirm which wezterm version you are running? The wezterm ls-fonts output is not consistent with the version you wrote above.

You're correct. I have both stable (via Homebrew) and nightly installed, sorry about that! Here's the updated output:

$ wezterm --version
wezterm 20220208-064631-dbf190d4
$ wezterm ls-fonts --text "✚28…8"
LeftToRight
 0 ✚    \u{271a}     x_adv=14 cells=1  glyph=19538 wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
 3 2    \u{32}       x_adv=7  cells=1  glyph=21   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
 4 8    \u{38}       x_adv=7  cells=1  glyph=27   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
 5 …    \u{2026}     x_adv=14 cells=1  glyph=18911 wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
 8 8    \u{38}       x_adv=7  cells=1  glyph=27   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText
Screenshot 2022-02-09 at 17 11 54
wez commented 2 years ago

U+271A and U+2026 are double the width of the other glyphs in that font, but both of those code points are defined as single-width, which is why the rendering looks crowded.

If you configure Terminal.app to use this font, it renders the same way as wezterm does.

You might think that it would be simple for wezterm to scale the glyph to fit the cell width, but that introduces ambiguity for ligatured glyphs like -> that legitimately span multiple cells. Speaking more plainly: that simple change would break most ligature rendering.

@be5invis: have you run into this sort of thing before? What would you recommend? I looked to see if there might have been a stylistic set that we could enable to request consistently mono-spaced glyphs but I didn't see one

be5invis commented 2 years ago

Use Iosevka Term, which is designed for such cases.

lithammer commented 2 years ago

Use Iosevka Term, which is designed for such cases.

The thing is, even if I change to "Iosevka Term". Wezterm seems to pick just "Iosevka". In fact, on stable it's not even possible to pick "Iosevka Term" and just results in an error (which is why I was using just "Iosevka" in the first place):

Unable to load a font specified by your font=wezterm.font('Iosevka Term', {weight="Regular", stretch='Normal', italic=false}) configuration. Fallback(s) are being used instead, and the terminal may not render as intended. See https://wezfurlong.org/wezterm/config/fonts.html for more information

On nightly, there are no errors. But it seems like the effective font is still just Iosevka rather than Iosevka Term.

$ grep -A3 -w font ~/.config/wezterm/wezterm.lua
  font = wezterm.font_with_fallback({
    "Iosevka Term",
    "Apple Color Emoji",
  }),
$ ./wezterm ls-fonts | grep Iosevka
  "Iosevka",
  {family="Iosevka", weight="ExtraLight", italic=true},
  {family="Iosevka", weight="ExtraLight"},
  {family="Iosevka", weight="DemiBold"},
  {family="Iosevka", weight="DemiBold", italic=true},
  {family="Iosevka", italic=true},
$ ./wezterm ls-fonts --text a
LeftToRight
 0 a    \u{61}       x_adv=7  cells=1  glyph=68   wezterm.font("Iosevka", {weight="Regular", stretch="Normal", italic=false})
                                      /Users/peter/Library/Fonts/iosevka-regular.ttc, CoreText

However I can see Iosevka Term in wezterm ls-fonts --list-system:

$ ./wezterm ls-fonts --list-system | grep 'Iosevka Term'
wezterm.font("Iosevka Term", {weight="Thin", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Thin", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Thin", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Normal", italic=false}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=1 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=8 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Normal", italic=true}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=9 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Thin", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Thin", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Thin", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-thin.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraLight", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extralight.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Light", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-light.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Regular", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-regular.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Medium", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-medium.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="DemiBold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-semibold.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Bold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-bold.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="ExtraBold", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-extrabold.ttc index=15 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Expanded", italic=false}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=4 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=14 variation=0, CoreText
wezterm.font("Iosevka Term", {weight="Black", stretch="Expanded", italic=true}) -- /Users/peter/Library/Fonts/iosevka-heavy.ttc index=15 variation=0, CoreText
lithammer commented 2 years ago

So maybe that's the real issue? The Iosevka font was installed using Homebrew if that helps/matters.

wez commented 2 years ago

There was an issue selecting the correct iosevka family when multiple .ttc files were installed; that should be fixed now in main, and should be available in a nightly download within an hour from now

lithammer commented 2 years ago

Just tested the latest nightly 48d6935f and can confirm that it solves the issue 👌 Thanks!

github-actions[bot] commented 1 year 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.