Subject: Re: bug#63029: [BUG?] format inconsistency in deciding string widths on different locales

From: Ruijie Yu <[email-masked]>
Date: Sun, 23 Apr 2023 22:23:16 +0800

Eli Zaretskii <[email-masked]> writes:

>> If this is expected behavior, how do we know how "wide" the `format'
>> function thinks any given character is?  In other words, why _does_ it
>> think "…" should be two-character wide?
>
> This is a kludgey feature: in CJK locales some characters are always
> considered double-width.  See code in characters.el that begins with a
> comment around line 1140.  The function use-cjk-char-width-table
> defined there is invoked (via the setup-function of the language
> environment) when the language environment in Emacs is set to one of
> those CJK locales.
>
> The reason for this is that in CJK fonts these characters are supposed
> to be rendered using full-width glyphs.
>
> See also bug#54138 and
> https://lists.gnu.org/archive/html/emacs-devel/2022-02/msg00917.html.

Thanks for the link.  I have found the answer in your response there.

>> And how do we, the elisp users, get this information?
>
> I don't understand this question.  Please elaborate: what information
> do you want to get, besides the width of the characters (which is
> accessible via char-width-table).

You mentioning `char-width-table' here and `char-width' on the linked
thread precisely answered my question.  I was looking for `char-width'
without knowing its name.  Thanks.

-- 
Best,

RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]