From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19872: 24.4; UTF8 characters of unusual width (Gnus markers) Date: Thu, 19 Feb 2015 08:30:15 +0200 Message-ID: <83lhju4dmw.fsf@gnu.org> References: <86bnkvilxl.fsf@example.com> <86r3tqchqt.fsf@example.com> <83zj8dua5s.fsf@gnu.org> <87oaotyxwn.fsf@building.gnus.org> <83fva47dak.fsf@gnu.org> <878ufwcamp.fsf@building.gnus.org> <83k2zf6g08.fsf@gnu.org> <87r3tmjvr2.fsf@building.gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1424327485 19394 80.91.229.3 (19 Feb 2015 06:31:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Feb 2015 06:31:25 +0000 (UTC) Cc: sva-news@mygooglest.com, 19872@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 19 07:31:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YOKdm-0004vT-B4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 07:31:14 +0100 Original-Received: from localhost ([::1]:55061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOKdl-0007Sb-HP for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 01:31:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOKdf-0007MJ-40 for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2015 01:31:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOKda-0005SY-QC for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2015 01:31:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOKda-0005SU-MD for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2015 01:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YOKdZ-00058B-U6; Thu, 19 Feb 2015 01:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Thu, 19 Feb 2015 06:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19872 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: Original-Received: via spool by 19872-submit@debbugs.gnu.org id=B19872.142432742019446 (code B ref 19872); Thu, 19 Feb 2015 06:31:01 +0000 Original-Received: (at 19872) by debbugs.gnu.org; 19 Feb 2015 06:30:20 +0000 Original-Received: from localhost ([127.0.0.1]:48300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YOKcn-00053T-RH for submit@debbugs.gnu.org; Thu, 19 Feb 2015 01:30:18 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:41503) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YOKce-00052L-2e for 19872@debbugs.gnu.org; Thu, 19 Feb 2015 01:30:08 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NK0004009PRR100@a-mtaout21.012.net.il> for 19872@debbugs.gnu.org; Thu, 19 Feb 2015 08:30:01 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NK00044TA21N4A0@a-mtaout21.012.net.il>; Thu, 19 Feb 2015 08:30:01 +0200 (IST) In-reply-to: <87r3tmjvr2.fsf@building.gnus.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99580 Archived-At: > From: Lars Ingebrigtsen > Cc: sva-news@mygooglest.com, 19872@debbugs.gnu.org > Date: Thu, 19 Feb 2015 16:49:53 +1100 > > Eli Zaretskii writes: > > > AFAIR, :align-to works in units of canonical character width, so this > > problem does not exist. > > I don't know what you mean by "canonical character width". It's the average width of the current frame's 'default' face's font. IOW, the value returned by 'frame-char-width'. Display-related functions usually count "columns" in these units. > If we've reserved space for 20 default-width characters, and we have a > strings like > > [12345678901234567890] Foo > [12345678901234567890] Foo > [12345678901234567890] Foo > [廣東話廣東話廣東話廣東話廣東話廣東話廣東] Foo > [12345678901234567890] Foo > [12345678901234567890] Foo > [12345678901234567890] Foo > [12345678901234567890] Foo > > no amount of align-to will make these columns line up. That's a separate problem. I thought you said that you were truncating too long strings, so I thought these cases were already taken care of. Do you use something like string-width or char-width to measure the width of strings on display while accounting for wide characters like the ones above and for zero-width combining characters? E.g., in this case string-width says that the string of Kanji characters is 40-column wide, even though it consists of only 20 characters. And for a string such as "ẛ̣", string-width returns 1, even though there are 3 characters there: u+017f, u+0323, and u+0307, because Emacs composes them on display into a single glyph (a.k.a. "grapheme cluster"). Since these strings typically use different fonts, the results are only approximately correct, but they are a much better approximation than if you count each character as 1 column on display.