Subject: Re: bug#76852: 30.1; Regression in whitespace-mode causes display issue under terminal

From: 张海 <[email-masked]>
Date: Thu, 13 Mar 2025 02:32:33 -0700

> Currently, the two solution I'm pondering are:
>
>   . remove from the list of ambiguous-width characters some of the
>     characters with low Unicode codepoints, including the 2 characters
>     used by whitespace-mode, on the assumption that these characters
>     are unlikely to be full-width in fonts used by Emacs users in CJK
>     locales

I wonder how emacs 29.4 dealt with this - did it also have a special
list of characters that it treats as half-width, while the rest are
treated as full-width like what was in the announcement?

>   . change the default of cjk-ambiguous-chars-are-wide to nil, on
>     the assumption that most users in CJK locales use fonts where
>     these characters have half-width glyphs

I think this might be a good option because both TTY and some popular
terminal emulators like gnome-terminal, gnome-console and foot ship
with the ambiguous CJK characters defaulted to half width. (Since I
tested them and saw how wide the middle dot was) And some of them
don't even offer an option to change it to full width. I don't know
about other terminal emulators like KConsole though.

> Thanks.  Let me think a bit more about what would be the best
> solution.  But could you tell which font you used that has full-width
> glyphs for these characters?  Is it unusual to use that font for
> terminal emulators in CJK locales?

The fonts I'm using, and most Chinese Linux users may be using (to my
understanding), are:
- WenQuanYi (WQY) fonts
- Noto (i.e. Source Han, a different branding) fonts
See also https://wiki.archlinux.org/title/Localization/Chinese

The WenQuanYi fonts have a much longer history and the middle dot is
always half width in them (checked just now). I'm currently using
WenQuanYi Micro Hei.

The Noto/Source Han fonts are relatively new and have an interesting
situation where the Noto Sans CJK SC/TC have the middle dot as full
width but Noto Sans CJK JP/KR have it as half width.

Some Microsoft proprietary system-default fonts for Chinese
characters, e.g. SimSun and SimHei, also have the middle dot as full
width, but I guess few Linux users would be using it.

I should also mention that some CJK users prepend an English font
before their CJK font for usage in UI/terminal, because English fonts
usually contain better quality glyphs for latin letters than the ones
embedded in CJK fonts - essentially they only use the CJK-only part of
the CJK fonts. So the middle dot will always be half width for them.

> I'm wondering why we didn't hear
> by now complaints from CJK users about the effects of
> cjk-ambiguous-chars-are-wide other than on whitespace-mode.  Maybe the
> other ambiguous-width characters are seldom used in practice?  Or
> maybe too little time has passed since Emacs 30 was released?

I think it could be both:

1. Emacs 30 is still new-ish, e.g. it landed in Arch Linux stable on
Feb 25, only two weeks ago

2. Not a lot of CJK users set a CJK locale ($LANG) for their terminal
- they usually set it for the DE but not necessarily in
/etc/locale.conf for the entire environment, because that means
localized messages won't appear properly under TTY with its default
font. I did that because I would manually set LANG if I actually have
to use TTY instead of a terminal emulator some day.