emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scratch/emoji vs emacs that maybe can始t display emojis


From: Eli Zaretskii
Subject: Re: scratch/emoji vs emacs that maybe can始t display emojis
Date: Sun, 07 Nov 2021 18:30:24 +0200

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]