wez / wezterm

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

Chinese char took a while to display #1206

Closed shaozi closed 2 years ago

shaozi commented 3 years ago

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

macOS

WezTerm version

20211004-231321-49d77138

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

When there is Chinese characters in display, it took a few seconds to update the char from garbage char to the right ones. Nightly is faster, but still noticeable. Consequential display is fine.

See attached screencast.

To Reproduce

No response

Configuration

local wezterm = require 'wezterm';
return {
  font_size = 15,
  use_ime = true,
  enable_scroll_bar = true,
  window_padding = {
    left = 2,
    -- This will become the scrollbar width if you have enabled the scrollbar!
    right = 8,
    top = 4,
    bottom = 0,
  },
  color = {
    scrollbar_thumb = "white",
  },
  inactive_pane_hsb = {
    saturation = 0.9,
    brightness = 0.8,
  },
  launch_menu = {
    {
      label = "Bash",
      args = {"bash", "-l"},
    },
  },

  keys = {
    {
     key = "d", mods="CMD",
     action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}
    },
    {
     key = "D", mods="CMD",
     action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}
    },
    {
     key="w", mods="CMD",
     action=wezterm.action{CloseCurrentPane={confirm=true}}
    }
  }
}

Expected Behavior

No response

Logs

No response

Anything else?

No response

shaozi commented 3 years ago

https://user-images.githubusercontent.com/417833/136059320-a779028c-26fb-45fc-a98c-d83a6a98a950.mov

wez commented 3 years ago

Those aren't garbage chars, they are last-resort placeholder glyphs.

What's happening is that when those characters are first used, wezterm needs to find a font that contains the glyphs for them. To do that, it has to get the system list of fallback fonts and examine each of them until it finds a font that contains them, and that can take a noticeable amount of time. While the search is in progress last-resort placeholder glyphs are used.

Nightly builds made significant improvements in the speed of the fallback lookup, but if that is still not fast enough for you, then you can explicitly add your choice of font as described here:

https://wezfurlong.org/wezterm/config/fonts.html#fallback

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.