unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: rpluim@gmail.com, emacs-devel@gnu.org
Subject: Re: scratch/emoji vs emacs that maybe canʼt display emojis
Date: Sun, 07 Nov 2021 18:30:24 +0200	[thread overview]
Message-ID: <837ddk7wtb.fsf@gnu.org> (raw)
In-Reply-To: <87sfw8eyi0.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun,  07 Nov 2021 17:12:07 +0100)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sun, 07 Nov 2021 17:12:07 +0100
> Cc: emacs-devel@gnu.org
> 
> Lars Ingebrigtsen <larsi@gnus.org> writes:
> 
> > 1) The string widths seem to be off (1 instead of 2), as Robert said
> > earlier.  So:
> 
> Not for all of them.  Normal single-char glyphs are correct:
> 
> (string-width "😀")
> => 2
> 
> But grapheme clusters are wrong:
> 
> (string-width "☺️")
> => 1
> 
> Presumably because it doesn't know that it's a cluster?

No, because Emacs has no way of knowing how wide is the cluster
produced by the terminal.  string-width with single characters
accesses our own data (in char-width-table), so we are okay.  But for
compositions on TTY frames we simply assume the result takes one
column, because what else can we do?

This problem has no solution, especially since different terminals
produce results of different sizes.  We could perhaps introduce some
heuristics based on the first character of the composition, for
example that the result of composing CH cannot be narrower than CH
itself.  But that will only work up to a point.  E.g., AFAIR some
Emoji has the width of 1.

And then there are terminal emulators that do some preposterous stuff,
assuming that their tail can wag the dog.  See PROBLEMS and search for
"kitty", for some fun.



  reply	other threads:[~2021-11-07 16:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  8:22 scratch/emoji vs emacs that maybe canʼt display emojis Robert Pluim
2021-11-05 11:57 ` Eli Zaretskii
2021-11-05 13:38   ` Robert Pluim
2021-11-05 14:25     ` Eli Zaretskii
2021-11-05 14:35       ` Robert Pluim
2021-11-06 14:30   ` Benjamin Riefenstahl
2021-11-05 14:30 ` Lars Ingebrigtsen
2021-11-05 14:38   ` Robert Pluim
2021-11-05 14:39     ` Lars Ingebrigtsen
2021-11-07 16:05     ` Lars Ingebrigtsen
2021-11-07 16:12       ` Lars Ingebrigtsen
2021-11-07 16:30         ` Eli Zaretskii [this message]
2021-11-07 20:48           ` Lars Ingebrigtsen
2021-11-07 22:31             ` Stefan Monnier
2021-11-07 23:16               ` Lars Ingebrigtsen
2021-11-09 11:37                 ` Richard Stallman
2021-11-09 23:40                   ` Lars Ingebrigtsen
2021-11-11  3:39                     ` scratch/emoji vs emacs that maybe canʼt " Richard Stallman
2021-11-11  3:44                       ` scratch/emoji vs emacs that maybe canʼt " Lars Ingebrigtsen
2021-11-12  4:23                         ` Richard Stallman
2021-11-14  5:17                         ` David Masterson
2021-11-14  5:24                           ` Lars Ingebrigtsen
2021-11-16  3:24                             ` David Masterson
2021-11-11 13:26                       ` Po Lu
2021-11-11 15:15                         ` Eli Zaretskii
2021-11-11 19:22                           ` Stefan Monnier
2021-11-11 19:32                             ` Eli Zaretskii
2021-11-12  0:42                               ` Po Lu
2021-11-08  0:39               ` scratch/emoji vs emacs that maybe canʼt " Tim Cross
2021-11-07 16:34         ` Benjamin Riefenstahl
2021-11-07 18:29           ` Eli Zaretskii
2021-11-07 16:25       ` Eli Zaretskii
2021-11-08 10:31         ` Robert Pluim
2021-11-08 10:33           ` Lars Ingebrigtsen
2021-11-08 10:52             ` Robert Pluim
2021-11-09  3:31               ` Lars Ingebrigtsen
2021-11-09 10:14                 ` Robert Pluim
2021-11-08 13:16             ` 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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=837ddk7wtb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=rpluim@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.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).