From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48149: 27.2; Wrong underline width when the line char has a width of 2 Date: Sun, 02 May 2021 19:23:02 +0300 Message-ID: <83im416r6h.fsf__23578.2062447228$1619974195$gmane$org@gnu.org> References: <87fsz62b1w.wl-shingo.fg8@gmail.com> <87a6pd86el.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: shingo.fg8@gmail.com, 48149@debbugs.gnu.org To: Nicolas Goaziou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 02 18:49:51 2021 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 1ldFHy-0002vD-Mq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 18:49:50 +0200 Original-Received: from localhost ([::1]:48802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldFHx-0008Ih-N8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 12:49:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldEt0-0004v2-5l; Sun, 02 May 2021 12:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldEsz-0001LU-RI; Sun, 02 May 2021 12:24:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldEsz-0004bF-N6; Sun, 02 May 2021 12:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: emacs-orgmode@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2021 16:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48149 X-GNU-PR-Package: org-mode,emacs Original-Received: via spool by 48149-submit@debbugs.gnu.org id=B48149.161997261117674 (code B ref 48149); Sun, 02 May 2021 16:24:01 +0000 Original-Received: (at 48149) by debbugs.gnu.org; 2 May 2021 16:23:31 +0000 Original-Received: from localhost ([127.0.0.1]:43569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldEsU-0004b0-Lg for submit@debbugs.gnu.org; Sun, 02 May 2021 12:23:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldEsT-0004au-1f for 48149@debbugs.gnu.org; Sun, 02 May 2021 12:23:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34343) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldEsN-0001Dh-D2; Sun, 02 May 2021 12:23:23 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4573 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ldEsM-0003fo-GU; Sun, 02 May 2021 12:23:22 -0400 In-Reply-To: <87a6pd86el.fsf@nicolasgoaziou.fr> (message from Nicolas Goaziou on Sun, 02 May 2021 18:08:50 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:205438 Archived-At: > From: Nicolas Goaziou > Date: Sun, 02 May 2021 18:08:50 +0200 > Cc: 48149@debbugs.gnu.org > > > In case of 1), it correctly takes account of the case in which the character > > has a width of 2 in `org-ascii--build-title', by dividing the line width by > > `(char-width under-char)' (line 700-701), maybe because the character is user > > configurable and its width in unknown. However, in case of 2) and > > 3), maybe because the characters is embedded in the code, it looks like only > > considering the character always has a width of 1. But the reality is > > character ?─ or ?━ can have a width of 2 in the screen displayed with some > > fonts (ex. "Noto Sans Mono CJK JP"), and in that case the line width gets > > doubled of the expected width. > > > > Attached one is a potential patch. The basic concepts are: > > > > a) Do the same in case of 2) and 3) as in case of 1) > > (dividing the line width by `(char-width under-char)', > > assuming `char-width-table' is correctly set) > > > > b) Prefer the longer line width if the width is odd, even in case of 1) > > (adding `(1- (char-width under-char))' to dividend, > > just because it should be more beautiful ;-) ) > > Thank you. This looks good. I cannot apply it on "maint" branch, > however. Also, a proper commit message would be nice. Could you send an > updated patch? Please note that using char-width cannot solve the problem of a character whose width depends on the font, because char-width is oblivious to fonts, it only knows about the character's codepoint.