Subject: bug#39799: 28.0.50; Most emoji sequences don’t render correctly

From: Eli Zaretskii <[email-masked]>
Date: Sat, 29 Feb 2020 13:19:39 +0200

> From: Mike FABIAN <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 29 Feb 2020 11:26:11 +0100
> 
> If I understand it correctly, with the current implementation in Emacs,
> it would work if a font had glyphs for both variation selectors.
> 
> I.e. if there was a font which had a colour glyph for
> 
> 24C2 FE0F  ; emoji style; # (1.1) CIRCLED LATIN CAPITAL LETTER M
> 
> *and* a black and white glyph for
> 
> 24C2 FE0E  ; text style;  # (1.1) CIRCLED LATIN CAPITAL LETTER M
> 
> Then it would work in Emacs and 24C2 FE0F would display in colour
> and 24C2 FE0E in black and white.

Yes, in that case Emacs will display both sequences using the same
font.

> But there are no such fonts (yet??). Symbola doesn’t support the
> variation selectors at all, i.e. when using Symbola
> 
> (set-fontset-font nil '(#x2460 . #x24FF) '("Symbola" . "iso10646-1") nil 'prepend)
> 
> one gets the three variants
> 
> Ⓜ U+24C2
> Ⓜ︎ U+24C2 U+FE0E
> Ⓜ️ U+24C2 U+FE0F
> 
> all in black and white and for the two variants which have the variation
> selectors one sees a narrow box in Emacs.
> 
> When using “Noto Color Emoji” or “Joypixels”, one gets all three
> variants in colour, and a box is only shown for the line in the middle
> with the U+FE0E text style selector because neither “Noto Color Emoji”
> nor “Joypixels” seem to implement that one. The emoji style selector
> U+FE0F does not show a box though, if I understand you correctly that
> means that apparently both “Noto Color Emoji” and “Joypixels” implement
> the U+FE0F variation selector.

OK, but then characters such as Ⓜ U+24C2 are supposed to be displayed
in their text presentation by default, so the sequence Ⓜ︎ U+24C2 U+FE0E
seems redundant, as it should display the same as just Ⓜ U+24C2.  So
this is not such a big loss for Emacs: you could use a font which
supports only the Ⓜ️ U+24C2 U+FE0F sequence, and use just Ⓜ U+24C2 for
the text presentation.

> If I paste these 3 lines into gedit (or anything else which uses pango
> for this) I see that different fonts  are used. Can also be seen with
> 
> pango-view --font="DejaVu Sans" ~/emoji-representation-test.txt

You could have the same in Emacs if you define a special face that
uses the other font, and then put that face on the sequence which
isn't composed using the font selected by Emacs.

> (I attached the emoji-representation-test.txt file and how it is
> displayed by pango-view).

I see only a small image showing the font name, and nothing else.
Some problem with sending the attachment?

> I specified the DejaVu Sans font on the command line (which is used for
> the ASCII text in that screenshot. For the emoji, different fonts are
> used, on my system where I made that screenshot it happens to be the
> font “MS Gothic” for the emoji in the first two lines and “Noto Color
> Emoji” for the last line. So pango uses different fonts for a text
> representation emoji sequence than for emoji representation.

Like I said, we need a more detailed understanding of how the font is
selected by Pango in these cases.