From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63029: [BUG?] format inconsistency in deciding string widths on different locales Date: Sun, 23 Apr 2023 22:23:16 +0800 Message-ID: References: <83bkjeznoh.fsf@gnu.org> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1975"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.22; emacs 30.0.50 Cc: 63029@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 23 16:30:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqajM-0000K9-PL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Apr 2023 16:30:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqaj7-0005bB-I1; Sun, 23 Apr 2023 10:30:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqaj5-0005al-JO for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 10:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqaj5-0003RJ-0Z for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 10:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqaj4-0001uk-TF for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 10:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Apr 2023 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63029 X-GNU-PR-Package: emacs Original-Received: via spool by 63029-submit@debbugs.gnu.org id=B63029.16822601637284 (code B ref 63029); Sun, 23 Apr 2023 14:30:02 +0000 Original-Received: (at 63029) by debbugs.gnu.org; 23 Apr 2023 14:29:23 +0000 Original-Received: from localhost ([127.0.0.1]:46559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqaiR-0001tQ-33 for submit@debbugs.gnu.org; Sun, 23 Apr 2023 10:29:23 -0400 Original-Received: from netyu.xyz ([152.44.41.246]:52486 helo=mail.netyu.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqaiQ-0001tI-04 for 63029@debbugs.gnu.org; Sun, 23 Apr 2023 10:29:22 -0400 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id ceb9861d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 23 Apr 2023 14:29:20 +0000 (UTC) In-reply-to: <83bkjeznoh.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260518 Archived-At: Eli Zaretskii 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 "=E2=80=A6" 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. --=20 Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.]