unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* A question about emojis - like \N{HEAVY BLACK HEART}
@ 2023-02-04  2:15 Eduardo Ochs
  2023-02-04  6:50 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Ochs @ 2023-02-04  2:15 UTC (permalink / raw)
  To: help-gnu-emacs

Hi list,

I tried to write a function that would display the emojis that I use
more, and I did the obvious thing: I started with `M-x emoji-list',
then selected my favorite emojis, then I wrote some macros that would
obtain their names - `C-u C-x =' on an emoji displays its name, but I
used other tricks - and I produced the function `my-emojis' that
displays each emoji with its name:

  (defun find-estring-mini (string)
    (switch-to-buffer "*string*")
    (kill-region (point-min) (point-max))
    (insert string))

  (defun my-emojis ()
    (interactive)
    (find-estring-mini "
  Slightly smiling face:    \N{SLIGHTLY SMILING FACE}
  Slightly frowning face:   \N{SLIGHTLY FROWNING FACE}
  Face without mouth:       \N{FACE WITHOUT MOUTH}
  Neutral face:             \N{NEUTRAL FACE}
  Upside-down face:         \N{UPSIDE-DOWN FACE}
  Confused face:            \N{CONFUSED FACE}
  Flushed face:             \N{FLUSHED FACE}
  Grimacing face:           \N{GRIMACING FACE}
  Thumbs up sign:           \N{THUMBS UP SIGN}
  Dog face:                 \N{DOG FACE}
  Pile of poo:              \N{PILE OF POO}
  Japanese ogre:            \N{JAPANESE OGRE}
  Thinking face:            \N{THINKING FACE}
  Face with stuck-out...:   \N{FACE WITH STUCK-OUT TONGUE}
  Grinning face with...:    \N{GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE}
  Face with stuck-out...:   \N{FACE WITH STUCK-OUT TONGUE AND
TIGHTLY-CLOSED EYES}

  Crying face:              \N{CRYING FACE}
  Disappointed but...:      \N{DISAPPOINTED BUT RELIEVED FACE}
  Loudly crying face:       \N{LOUDLY CRYING FACE}
  Face screaming in fear:   \N{FACE SCREAMING IN FEAR}
  Confounded face:          \N{CONFOUNDED FACE}
  Angry face:               \N{ANGRY FACE}
  Pouting face:             \N{POUTING FACE}
  Serious face with...:     \N{SERIOUS FACE WITH SYMBOLS COVERING MOUTH}
  Orange heart:             \N{ORANGE HEART}
  Yellow heart:             \N{YELLOW HEART}
  Green heart:              \N{GREEN HEART}
  Blue heart:               \N{BLUE HEART}
  Purple heart:             \N{PURPLE HEART}
  Brown heart:              \N{BROWN HEART}

  Heavy black heart:        \N{HEAVY BLACK HEART}
  White frowning face:      \N{WHITE FROWNING FACE}
    "))


It turns out that the last two emojis are displayed in a way that is
less nice than the other ones... here is a screenshot:

  https://i.ibb.co/ZdxN77r/sshot.png

Then I tried to save my temporary buffer with emojis to a file, and I
used a small Lua script to replace each character >127 in it with its
hex code, and got this:

  Slightly smiling face:    (F0)(9F)(99)(82)
  Slightly frowning face:   (F0)(9F)(99)(81)
  Face without mouth:       (F0)(9F)(98)(B6)
  Neutral face:             (F0)(9F)(98)(90)
  Upside-down face:         (F0)(9F)(99)(83)
  Confused face:            (F0)(9F)(98)(95)
  Flushed face:             (F0)(9F)(98)(B3)
  Grimacing face:           (F0)(9F)(98)(AC)
  Thumbs up sign:           (F0)(9F)(91)(8D)
  Dog face:                 (F0)(9F)(90)(B6)
  Pile of poo:              (F0)(9F)(92)(A9)
  Japanese ogre:            (F0)(9F)(91)(B9)
  Thinking face:            (F0)(9F)(A4)(94)
  Face with stuck-out...:   (F0)(9F)(98)(9B)
  Grinning face with...:    (F0)(9F)(A4)(AA)
  Face with stuck-out...:   (F0)(9F)(98)(9D)

  Crying face:              (F0)(9F)(98)(A2)
  Disappointed but...:      (F0)(9F)(98)(A5)
  Loudly crying face:       (F0)(9F)(98)(AD)
  Face screaming in fear:   (F0)(9F)(98)(B1)
  Confounded face:          (F0)(9F)(98)(96)
  Angry face:               (F0)(9F)(98)(A0)
  Pouting face:             (F0)(9F)(98)(A1)
  Serious face with...:     (F0)(9F)(A4)(AC)
  Orange heart:             (F0)(9F)(A7)(A1)
  Yellow heart:             (F0)(9F)(92)(9B)
  Green heart:              (F0)(9F)(92)(9A)
  Blue heart:               (F0)(9F)(92)(99)
  Purple heart:             (F0)(9F)(92)(9C)
  Brown heart:              (F0)(9F)(A4)(8E)

  Heavy black heart:        (E2)(9D)(A4)
  White frowning face:      (E2)(98)(B9)

This _may be_ the reason why "\N{HEAVY BLACK HEART}" and
"\N{WHITE FROWNING FACE}" are generating uglier versions of
the emojis.

What's the recommended way to fix this?
  Thanks in advance!
    Eduardo Ochs
    http://anggtwu.net/#eev
    http://anggtwu.net/eepitch.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A question about emojis - like \N{HEAVY BLACK HEART}
  2023-02-04  2:15 A question about emojis - like \N{HEAVY BLACK HEART} Eduardo Ochs
@ 2023-02-04  6:50 ` Eli Zaretskii
  2023-02-04  9:00   ` Eduardo Ochs
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-02-04  6:50 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Eduardo Ochs <eduardoochs@gmail.com>
> Date: Fri, 3 Feb 2023 23:15:50 -0300
> 
>   Heavy black heart:        (E2)(9D)(A4)
>   White frowning face:      (E2)(98)(B9)
> 
> This _may be_ the reason why "\N{HEAVY BLACK HEART}" and
> "\N{WHITE FROWNING FACE}" are generating uglier versions of
> the emojis.

What is? what do you see in the last 2 sequences which tells you that
they should display differently?

> What's the recommended way to fix this?

Append u+FE0F to each one of those.

These characters are not by default considered Emoji, because that's
what Unicode says about them.  If you evaluate, for example,

   M-: (aref char-script-table ?❤) RET

you will see that it yields 'symbol', not 'emoji'.  To ask Emacs to
display the Emoji appearance of these two characters, you must follow
them with u+FE0F.  The other characters yield 'emoji' from the above
expression, so they are displayed as Emoji by default.

The reason for this behavior is that many symbol characters have dual
purpose, both as "normal" symbol and as Emoji, and we don't want them
to display as Emoji by default, which will surprise and perhaps annoy
when this happens in plain text.  Emacs behaves here as Unicode
mandates, by displaying each symbol according to its default
appearance, and by supporting the alternate appearance when the
character sequence requests that.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A question about emojis - like \N{HEAVY BLACK HEART}
  2023-02-04  6:50 ` Eli Zaretskii
@ 2023-02-04  9:00   ` Eduardo Ochs
  0 siblings, 0 replies; 3+ messages in thread
From: Eduardo Ochs @ 2023-02-04  9:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Sat, 4 Feb 2023 at 03:51, Eli Zaretskii <eliz@gnu.org> wrote:
>
> Append u+FE0F to each one of those.
>
> These characters are not by default considered Emoji, because that's
> what Unicode says about them.  If you evaluate, for example,
>
>    M-: (aref char-script-table ?❤) RET
>
> you will see that it yields 'symbol', not 'emoji'.  To ask Emacs to
> display the Emoji appearance of these two characters, you must follow
> them with u+FE0F.  The other characters yield 'emoji' from the above
> expression, so they are displayed as Emoji by default.
>
> The reason for this behavior is that many symbol characters have dual
> purpose, both as "normal" symbol and as Emoji, and we don't want them
> to display as Emoji by default, which will surprise and perhaps annoy
> when this happens in plain text.  Emacs behaves here as Unicode
> mandates, by displaying each symbol according to its default
> appearance, and by supporting the alternate appearance when the
> character sequence requests that.

Hi Eli! Perfect, thanks! =)
Here is the fixed code, with the u+FE0F in two different syntaxes:

  (defun find-estring-mini (string)
    (switch-to-buffer "*string*")
    (kill-region (point-min) (point-max))
    (insert string))

  (defun my-emojis ()
    (interactive)
    (find-estring-mini "
  Slightly smiling face:    \N{SLIGHTLY SMILING FACE}
  Slightly frowning face:   \N{SLIGHTLY FROWNING FACE}
  Face without mouth:       \N{FACE WITHOUT MOUTH}
  Neutral face:             \N{NEUTRAL FACE}
  Upside-down face:         \N{UPSIDE-DOWN FACE}
  Confused face:            \N{CONFUSED FACE}
  Flushed face:             \N{FLUSHED FACE}
  Grimacing face:           \N{GRIMACING FACE}
  Thumbs up sign:           \N{THUMBS UP SIGN}
  Dog face:                 \N{DOG FACE}
  Pile of poo:              \N{PILE OF POO}
  Japanese ogre:            \N{JAPANESE OGRE}
  Thinking face:            \N{THINKING FACE}
  Face with stuck-out...:   \N{FACE WITH STUCK-OUT TONGUE}
  Grinning face with...:    \N{GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE}
  Face with stuck-out...:   \N{FACE WITH STUCK-OUT TONGUE AND
TIGHTLY-CLOSED EYES}

  Crying face:              \N{CRYING FACE}
  Disappointed but...:      \N{DISAPPOINTED BUT RELIEVED FACE}
  Loudly crying face:       \N{LOUDLY CRYING FACE}
  Face screaming in fear:   \N{FACE SCREAMING IN FEAR}
  Confounded face:          \N{CONFOUNDED FACE}
  Angry face:               \N{ANGRY FACE}
  Pouting face:             \N{POUTING FACE}
  Serious face with...:     \N{SERIOUS FACE WITH SYMBOLS COVERING MOUTH}
  Orange heart:             \N{ORANGE HEART}
  Yellow heart:             \N{YELLOW HEART}
  Green heart:              \N{GREEN HEART}
  Blue heart:               \N{BLUE HEART}
  Purple heart:             \N{PURPLE HEART}
  Brown heart:              \N{BROWN HEART}

  Heavy black heart:        \N{HEAVY BLACK HEART}\N{VARIATION SELECTOR-16}
  White frowning face:      \N{WHITE FROWNING FACE}\uFE0F
    "))

Cheers,
  Eduardo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-04  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-04  2:15 A question about emojis - like \N{HEAVY BLACK HEART} Eduardo Ochs
2023-02-04  6:50 ` Eli Zaretskii
2023-02-04  9:00   ` Eduardo Ochs

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).