From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id e67vM5dSjmC9ZQAAgWs5BA (envelope-from ) for ; Sun, 02 May 2021 09:19:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id +HfoLpdSjmAXMwAAbx9fmQ (envelope-from ) for ; Sun, 02 May 2021 07:19:51 +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 074A82007B for ; Sun, 2 May 2021 09:19:51 +0200 (CEST) Received: from localhost ([::1]:43842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ld6OM-0005O0-58 for larch@yhetil.org; Sun, 02 May 2021 03:19:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld6Nc-0005No-1I; Sun, 02 May 2021 03:19:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ld6Na-0001au-TX; Sun, 02 May 2021 03:19:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ld6Na-0007Jy-QD; Sun, 02 May 2021 03:19:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#48149: 27.2; Wrong underline width when the line char has a width of 2 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 07:19:02 +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: Shingo Tanaka Received: via spool by 48149-submit@debbugs.gnu.org id=B48149.161993990128107 (code B ref 48149); Sun, 02 May 2021 07:19:02 +0000 Received: (at 48149) by debbugs.gnu.org; 2 May 2021 07:18:21 +0000 Received: from localhost ([127.0.0.1]:41069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld6Mv-0007JH-Ko for submit@debbugs.gnu.org; Sun, 02 May 2021 03:18:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld6Mt-0007J9-Tz for 48149@debbugs.gnu.org; Sun, 02 May 2021 03:18:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57273) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ld6Mo-00010C-OB; Sun, 02 May 2021 03:18:14 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2429 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ld6Mn-0001zH-4S; Sun, 02 May 2021 03:18:14 -0400 Date: Sun, 02 May 2021 10:17:53 +0300 Message-Id: <837dkh8uzi.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87fsz62b1w.wl-shingo.fg8@gmail.com> (message from Shingo Tanaka on Sun, 02 May 2021 10:12:43 +0900) References: <87fsz62b1w.wl-shingo.fg8@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: emacs-orgmode@gnu.org List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 48149@debbugs.gnu.org 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=1619939991; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=SMepgEaX4AuUJ3FqtC4NszbUSnefR13Npn9iarzAFys=; b=JEJ9fhS+AhduhLNPfeaSuW8UVdC7W3vNjzxxVGwOmcMGlRSZDbnYmFH7QH8I/VuqEWIAb4 U82tcz0MCV44xAP7YqaScI/eICaKT7l+5GzINzKLQrI8CuQKRtf7bFKCGamuAotwlvdv9l AKgzQtcnGRivhJTT9v+J5G4k/77iPpN9RT1jXjWFSPb19x/jP2FFPw1SgVEa1Jtn6oyQoy zUMR+KpUgtToF3zqbgHAKm6sR0hbtK3x2WglhWQYBNHRS1TFIJXajRQhW78cJkfl/neJmd 1J0NcjE7qi2fEURANDnRWAbfJY5nMTkN+r2b3YcuTypLf1lP03cGgh/RQIUIpw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619939991; a=rsa-sha256; cv=none; b=W9oC043f3YnGof68RHoAlRwGuD+NWiyY3zm1tyaEQY/W3ckf0DTbpM3IJmrntPtl9uCEGq DgGe6VgLqjbC0e/xJKPFPqvKzMtwUqcXz/Oa79BBBbGaA6lZwhdgLh0op9uUqNlOYOpKvY 3PZD7O5lGg770USgE3lQw1u4QHILF33KG4QvBVutbfoPc+MWIu8y4cLR8VRAiPX4qnHC5E laZPAK4F4ZOivtWWzKQdbhRlHsehs1iOIUGxaKTfBqeFjBili9Kp/sbPvEMukUPzz4Er4Z F4ADGdf9/bXt5v7K8LJ79l9kF2WX23GS/lP1lL4PqxqmU6akV7+k4b6rqa7k2A== 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: -2.96 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: 074A82007B X-Spam-Score: -2.96 X-Migadu-Scanner: scn0.migadu.com X-TUID: LVHU5i67uBKr > 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.