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: Benjamin Riefenstahl
Subject: Re: scratch/emoji vs emacs that maybe canʼt display emojis
Date: Sun, 07 Nov 2021 17:34:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

I note that the display in my Gnome-Terminal follows the output of
string-width as you show it.  So this terminal emulator and Emacs at
least are in agreement ;-).

Lars Ingebrigtsen writes:
> Not for all of them.  Normal single-char glyphs are correct:
>
> (string-width "😀")
> => 2

This is shown correctly, the emoji occupies two columns.

> But grapheme clusters are wrong:
>
> (string-width "☺️")
> => 1

Here the display of the emoji also occupies two columns, IOW the glyph
is correctly display by the font.  But the closing quote overlaps the
emoji, probably because the terminal thinks it is just one column wide.

> Presumably because it doesn't know that it's a cluster?  Because it
> computes the width of just the first code point without the variation
> selector:
>
> (string-width "☺")
> => 1

Here the emoji has only one column, and this is shown correctly.


Another note: In my own work with this issue, using NCurses, I have
noticed that NCurses mostly relies on the C library's wcwidth function.
Which seems reasonable for NCurses.  I am not saying that Emacs should
do the same, but I expect NCurses and terminal emulators to develop in a
certain dependency, because it seem that NCurses is the most-used
full-screen terminal library these days.




reply via email to

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