From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id C2/zGIukjmAP5gAAgWs5BA (envelope-from ) for ; Sun, 02 May 2021 15:09:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ULwbFIukjmAIAwAA1q6Kng (envelope-from ) for ; Sun, 02 May 2021 13:09:31 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B808F24C90 for ; Sun, 2 May 2021 15:09:30 +0200 (CEST) Received: from localhost ([::1]:55290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldBqj-0002H8-CG for larch@yhetil.org; Sun, 02 May 2021 09:09:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld7dy-0008Fu-UC; Sun, 02 May 2021 04:40:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ld7dx-0007XP-Ow; Sun, 02 May 2021 04:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ld7dx-0008Ox-Lo; Sun, 02 May 2021 04:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#48149: 27.2; Wrong underline width when the line char has a width of 2 In-Reply-To: <87fsz62b1w.wl-shingo.fg8@gmail.com> Resent-From: Rudolf Schlatte Original-Sender: "Debbugs-submit" Resent-CC: emacs-orgmode@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2021 08:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48149 X-GNU-PR-Package: org-mode,emacs X-GNU-PR-Keywords: To: 48149@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161994475032266 (code B ref -1); Sun, 02 May 2021 08:40:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 May 2021 08:39:10 +0000 Received: from localhost ([127.0.0.1]:41510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld7d7-0008OL-NG for submit@debbugs.gnu.org; Sun, 02 May 2021 04:39:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:55412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld7d5-0008OE-Cp for submit@debbugs.gnu.org; Sun, 02 May 2021 04:39:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld7d5-0007se-3I for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 04:39:07 -0400 Received: from ciao.gmane.io ([116.202.254.214]:55592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld7d3-000759-8n for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 04:39:06 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ld7cz-0005lJ-Ah for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 10:39:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Rudolf Schlatte Date: Sun, 02 May 2021 10:36:14 +0200 Message-ID: References: <87fsz62b1w.wl-shingo.fg8@gmail.com> <837dkh8uzi.fsf__22492.4155323365$1619940077$gmane$org@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cancel-Lock: sha1:A9/Fs2ExA5c5KofSF+d0kMFXOac= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sun, 02 May 2021 09:08:51 -0400 X-BeenThere: emacs-orgmode@gnu.org List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619960970; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=U7Mc1vnAbmvE9IswtBsoy4FFMGhirSG90LAds7Vm01Q=; b=bCl2NRrREjuqpGv1UDBuAYtYT1tiqR0mLLGkaobDstDZ1qlnz3tGGkEezV+c62sg/1FeV5 ySjDqQQSlobZOthFJ/XxtFZ1eugYwGM21H2eS9n8vmaixU0yfoMocC7h4Q5TMrk/3JF30V lNaWuVGE7m2KlkWRQGlRhXhwgxNv+mDmq9EQbK0dWIXurnrcgeAnXsckXyaY3T62Bi4R5c eY+TozJ/4cT+7I8z/pyVLqgAVYBbCQnS8p0BrMg1c+52c38xJQtXgX93N2nis8e1zRAv9m yZIPOgW8i7HZGaguwIsazPkEP+NsG1ZC4TydmpE/nNmoLdH8VQEL5i8Tq6u8Zg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619960970; a=rsa-sha256; cv=none; b=HgrTiuvyoiPvyT7L//iaJoowwDYlcyMDQH4SeJD4KRmDdz6aHFJDjgNoUmPCMKpy5rQkiT gtKhRy/v+dmj/72kDkdvIg5mROB1pBA9zcMQfWB+d9/q2qCXsXuUiTqz/J1CEEx/MGgIGv IREHoE10r/ZO5ozVL/42qOf9NbtFY6as6NVwd/vKXit+sHneRTskiAKOggyfUz4PxIk1c+ 7xItXGXfC0bXiYNV4vPo3uKqKRxelMMDK7pZmcnhpwVC/C+sVlRx79suIFeCfyhHLkRrDA SMIs6z2MqBf3AkeNuHk0CruA6SxQ/KmB2UZYqIixFgQ6tgOF20y2IorbBd4neg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.46 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B808F24C90 X-Spam-Score: -0.46 X-Migadu-Scanner: scn0.migadu.com X-TUID: F/1GF0S01JiD Eli Zaretskii writes: >> Date: Sun, 02 May 2021 10:12:43 +0900 >> From: Shingo Tanaka >> >> When exporting org-mode document to plain text (either ascii/unicode/utf-8) >> with `org-export-dispatch', Emacs inserts lines under headlines, inline >> tasks, table rows and titles of the document, TOC, list of listings, list of >> tables and footnotes. The problem is it inserts too long (double width) line >> when the line character has a width of 2. >> >> Those lines are made of 3 types of characters below (in ox-ascii.el): >> 1) org-ascii-underline >> 2) (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_) >> 3) (if utf8p ?━ ?_) >> >> 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 ;-) ) > > You reported a similar bug already, and I replied there that TRT in > these cases is to use window-text-pixel-size, which will automatically > account for the actual width on display of any characters and any > fonts specified for displaying them. char-width is an approximation, > and is accurate only on TTY frames. Isn't the primary result of org-export a plain (UTF-8) text file, instead of an emacs buffer to be displayed in a GUI or TTY frame? If so, maybe the criterion for correctness should be that "cat filename.txt" looks as expected in a terminal, even if opening that file in Emacs shows lines of different lengths due to variable-pitch faces etc.