all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: sva-news@mygooglest.com, 19872@debbugs.gnu.org
Subject: bug#19872: 24.4; UTF8 characters of unusual width (Gnus markers)
Date: Thu, 19 Feb 2015 08:30:15 +0200	[thread overview]
Message-ID: <83lhju4dmw.fsf@gnu.org> (raw)
In-Reply-To: <87r3tmjvr2.fsf@building.gnus.org>

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: sva-news@mygooglest.com,  19872@debbugs.gnu.org
> Date: Thu, 19 Feb 2015 16:49:53 +1100
> 
> Eli Zaretskii <eliz@gnu.org> 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.





  reply	other threads:[~2015-02-19  6:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-15  9:05 bug#19872: 24.4; UTF8 characters of unusual width (Gnus markers) Sebastien Vauban
2015-02-15 16:27 ` Eli Zaretskii
     [not found] ` <mailman.138.1424017693.31049.bug-gnu-emacs@gnu.org>
     [not found]   ` <mailman.138.1424017693.31049.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2015-02-16  9:45     ` Sebastien Vauban
2015-02-16 15:51       ` Eli Zaretskii
2015-02-16 20:10         ` Stefan Monnier
2015-02-17  4:17         ` Lars Ingebrigtsen
2015-02-17 15:44           ` Eli Zaretskii
2015-02-18  0:43             ` Lars Ingebrigtsen
2015-02-18  3:43               ` Eli Zaretskii
2015-02-19  5:49                 ` Lars Ingebrigtsen
2015-02-19  6:30                   ` Eli Zaretskii [this message]
2015-02-19 13:49                     ` Stefan Monnier
2015-02-19 14:03                       ` Eli Zaretskii
2015-02-19 16:12                         ` Columns and proportional fonts (was: bug#19872: 24.4; UTF8 characters of unusual width (Gnus markers)) Stefan Monnier
2015-02-19 17:37                           ` Columns and proportional fonts Ivan Shmakov
2015-02-19 18:09                             ` Eli Zaretskii
2015-02-19 18:41                             ` Stefan Monnier
2015-02-18  3:49           ` bug#19872: 24.4; UTF8 characters of unusual width (Gnus markers) Stefan Monnier
2016-02-07  6:04 ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=83lhju4dmw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=19872@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=sva-news@mygooglest.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.