GNU bug report logs -
#64420
string-width of … is 2 in CJK environments
Previous Next
Full log
View this message in rfc822 format
> On Aug 11, 2023, at 11:36 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Fri, 11 Aug 2023 11:07:26 -0700
>> Cc: dmitry <at> gutov.dev,
>> itaemu <at> gmail.com,
>> 64420 <at> debbugs.gnu.org
>>
>> On terminal, I saw an interesting option, “Ambiguous characters are double-width” (terminal-setting.png), which is the same as cjk-ambiguous-chars-are-wide. If I turn it on all the ambiguous characters are indeed displayed in double-width. (terminal-narrow.png, terminal-wide.png)
>
> And in that case, you need to set cjk-ambiguous-chars-are-wide non-nil
> to have Emacs display those characters correctly? Or does that option
> have no effect on the correctness of the |Emacs display on that
> terminal?
The value of cjk-ambiguous-chars-are-wide has no effect on the display of those characters in the terminal, at least in the terminal I use (iTerm2). Only the terminal option has an effect.
The screenshot I took are actually from cat, not Emacs. I tried with Emacs and found out that the terminal and Emacs must agree on the width of those characters, otherwise the cursor movement is broken (perhaps that’s not surprising to you). The cursor movement works if either a) I turn on "Ambiguous characters are double-width” in the terminal and (set-language-environment "Chinese-BIG5”) in Emacs, or b) I turn off "Ambiguous characters are double-width” (which is off by default) and use default locale (utf8_enUS).
>
>> On GUI display, the later-half of the ambiguous characters are definitely wider than one char, but they aren’t quite 2 chars wide either. But I guess it doesn’t matter too much since one should use pixel size on GUI anyway.
>
> Is the actual width closer to 1 or to 2?
>
I’d say 2.
Yuan
This bug report was last modified 2 years and 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.