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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 13 Mar 2025 16:11:35 +0200

> From: 张海 <[email-masked]>
> Date: Thu, 13 Mar 2025 02:32:33 -0700
> Cc: [email-masked]
> 
> > 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?

Emacs 29 didn't have the notion of ambiguous-width characters.  Each
character was either a half-width or a full-width.  And the characters
used by whitespace-mode were half-width.

> >   . 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.

Yes, but are we sure that users in CJK locales don't customize
terminal emulators to default the ambiguous-width characters to
full-width?  If many users do that, then Emacs should cater to the
majority.

> > 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.

Thanks for the info, I will think about this some more.