wez / wezterm

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

WezTerm failed to render partial Chinese character #6045

Closed hitsmaxft closed 1 month ago

hitsmaxft commented 1 month 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

20240812-215703-30345b36

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

Wezterm couldn't render some Chinese characters properly, show with box placeholder

图片

Testing with ls-font complains No fonts contain glyphs for these codepoints: \u{663e} .

Here are log from ls-font command to show font detail of characters:

wezterm ls-fonts --text '显示中文'
19:31:39.818  WARN   wezterm_font > No fonts contain glyphs for these codepoints: \u{663e}.
Placeholder glyphs are being displayed instead.
You may wish to install additional fonts, or adjust your
configuration so that it can find them.
https://wezfurlong.org/wezterm/config/fonts.html has more information about configuring fonts.
Set warn_about_missing_glyphs=false to suppress this message.
LeftToRight
 0 显    \u{663e}     x_adv=19.203125 cells=2  glyph=.notdef,0    wezterm.font("PT Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/Supplemental/PTMono.ttc index=1 variation=0, CoreText
 3 示    \u{793a}     x_adv=27.6875 cells=2  glyph=5710 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText
 6 中    \u{4e2d}     x_adv=27.6875 cells=2  glyph=6922 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText
 9 文    \u{6587}     x_adv=27.6875 cells=2  glyph=4840 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText

\u{663e} is 显 https://www.compart.com/en/unicode/U+663E, other characters are just ok.

To Reproduce

wezterm ls-fonts --text '显示中文'
19:31:39.818  WARN   wezterm_font > No fonts contain glyphs for these codepoints: \u{663e}.
Placeholder glyphs are being displayed instead.
You may wish to install additional fonts, or adjust your
configuration so that it can find them.
https://wezfurlong.org/wezterm/config/fonts.html has more information about configuring fonts.
Set warn_about_missing_glyphs=false to suppress this message.
LeftToRight
 0 显    \u{663e}     x_adv=19.203125 cells=2  glyph=.notdef,0    wezterm.font("PT Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/Supplemental/PTMono.ttc index=1 variation=0, CoreText
 3 示    \u{793a}     x_adv=27.6875 cells=2  glyph=5710 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText
 6 中    \u{4e2d}     x_adv=27.6875 cells=2  glyph=6922 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText
 9 文    \u{6587}     x_adv=27.6875 cells=2  glyph=4840 wezterm.font(".Apple SD Gothic NeoI", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/AppleSDGothicNeo.ttc index=1 variation=0, CoreText

Configuration

reproduced with -n , no config

Expected Behavior

No response

Logs

❯ wezterm -n 2024-08-27 19:34:00.978 wezterm-gui[75519:40233187] +[IMKClient subclass]: chose IMKClient_Legacy 2024-08-27 19:34:03.126 wezterm-gui[75519:40233187] +[IMKInputSession subclass]: chose IMKInputSession_Legacy 19:34:09.881 WARN wezterm_font > No fonts contain glyphs for these codepoints: \u{663e}. Placeholder glyphs are being displayed instead. You may wish to install additional fonts, or adjust your configuration so that it can find them. https://wezfurlong.org/wezterm/config/fonts.html has more information about configuring fonts. Set warn_about_missing_glyphs=false to suppress this message.

Anything else?

mac os version Darwin xxxxx 24.0.0 Darwin Kernel Version 24.0.0: Mon Jul 1 21:56:49 PDT 2024; root:xnu-11215.0.132.501.1~1/RELEASE_ARM64_T6020 arm64 arm Darwin

szcharlesji commented 1 month ago

Use PingFang instead.

❯ wezterm ls-fonts --text '显示中文'
LeftToRight
 0 显    \u{663e}     x_adv=16 cells=2  glyph=3604 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText
 3 示    \u{793a}     x_adv=16 cells=2  glyph=5135 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText
 6 中    \u{4e2d}     x_adv=16 cells=2  glyph=1278 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText
 9 文    \u{6587}     x_adv=16 cells=2  glyph=3528 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText
hitsmaxft commented 1 month ago

Use PingFang instead.


❯ wezterm ls-fonts --text '显示中文'

LeftToRight

 0 显    \u{663e}     x_adv=16 cells=2  glyph=3604 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})

                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText

 3 示    \u{793a}     x_adv=16 cells=2  glyph=5135 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})

                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText

 6 中    \u{4e2d}     x_adv=16 cells=2  glyph=1278 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})

                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText

 9 文    \u{6587}     x_adv=16 cells=2  glyph=3528 wezterm.font("PingFang HK", {weight="Regular", stretch="Normal", style="Normal"})

                                      /System/Library/AssetsV2/com_apple_MobileAsset_Font7/3419f2a427639ad8c8e139149a287865a90fa17e.asset/AssetData/PingFang.ttc, CoreText

thank you for replaying。

I've tried using Pingfang as last fallback option,but it doesn't work. then I observed that the Pingfang did not appear in the --system

finally I use Lantinghei to solve this problem.

vinoMamba commented 4 weeks ago

Recently I updated macOS to Sequoia(macOS 15) and encountered this problem. Then I download the Ping Fang font in Font Book

image
bboysoulcn commented 3 weeks ago

萍芳字体

thanks, the same as you

hitsmaxft commented 3 weeks ago

It seems that PingFang is not installed by default in Sequoia. But I fail to install it in Font book in previous beta, and this bug is fixed in later updates Now Ping Fang works again by downloading from font book

Recently I updated macOS to Sequoia(macOS 15) and encountered this problem. Then I download the Ping Fang font in Font Book

image