emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: shingo.fg8@gmail.com, 48148-done@debbugs.gnu.org
Subject: bug#48148: 27.2; ox-ascii breaks TITLE line wrongly when 2 width char is used
Date: Sun, 02 May 2021 17:56:04 +0200	[thread overview]
Message-ID: <87eeep86zv.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <83tunl714h.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 02 May 2021 15:48:14 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
>> Cc: shingo.fg8@gmail.com,  48148@debbugs.gnu.org
>> Date: Sun, 02 May 2021 14:18:24 +0200
>> 
>> My problem is that I have some string, _which is not displayed anywhere_
>> yet. I need to obtain its real width along with the width of a single
>> character in order to compute the length argument in `make-string'.
>
> The width of any text on display is meaningless unless you also tell
> in what window will it be displayed.  That's because some of the
> factors that affect the display width depend on the window and the
> buffer shown by that window.

I understand. More than the width of the text, I'm interested in the
ratio between the width of the text and the width of an underline
character (assuming monospace).

> So assuming the string you have will eventually be displayed in some
> window -- and most strings in Emacs are of that kind -- you should use
> that window up front.  Otherwise, the value you get from other methods
> can only be an approximation, which will sometimes be close, and
> sometimes quite far from the truth.

The string may not be displayed at all. Since it is the output of an
export process, it could, e.g., be written to a file.

I applied Shingo Tanaka's suggestion using `string-width', which is the
best we can do considering our requirements.

Thank you for your answer, and to Shingo Tanaka for the report an the
patch.

Regards,





  reply	other threads:[~2021-05-02 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87h7jm2es2.wl-shingo.fg8@gmail.com>
2021-05-02  7:03 ` bug#48148: 27.2; ox-ascii breaks TITLE line wrongly when 2 width char is used Eli Zaretskii
2021-05-02  8:23   ` Nicolas Goaziou
2021-05-02  9:11     ` Eli Zaretskii
2021-05-02 11:33       ` Shingo Tanaka
2021-05-02 12:43         ` Eli Zaretskii
2021-05-02 12:18       ` Nicolas Goaziou
2021-05-02 12:48         ` Eli Zaretskii
2021-05-02 15:56           ` Nicolas Goaziou [this message]
2021-05-02 16:11             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeep86zv.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=48148-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=shingo.fg8@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).