Subject: Re: bug#54441: 28.0.92; set-language-environment causes Apple Color Emoji cannot show up

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Mar 2022 08:53:11 +0200

[Please use Reply All so that the bug tracker is CC'ed.]

> From: Will Chang <[email-masked]>
> Date: Sat, 19 Mar 2022 11:06:06 +0800
> 
> >does this happen in "emacs -Q", if you evaluate the above
> immediately upon entering Emacs?
> 
> Yes. Tested it on:
> "GNU Emacs 28.0.92 (build 2, x86_64-apple-darwin21.4.0, Carbon Version 165
> AppKit 2113.4)
>  of 2022-03-18"
> "GNU Emacs 28.0.92 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
> Version 10.14.6 (Build 18G95))
>  of 2022-03-14"
> 
> > what is the language environment before the evaluation of
>     set-language-environment above?
> 
> I run describe-language-environment and got:
> 
> English language environment
> 
> Nothing special is needed to handle English.
> 
> Sample text:
>   Hello!, Hi!, How are you?
> 
> Input methods:
>   programmer-dvorak ("DVP@" in mode line)
>   english-dvorak ("DV@" in mode line)
> 
> Character sets:
>   ascii: ASCII (ISO646 IRV)
> 
> Coding systems:
>   nothing specific to English

So it's a "C" (a.k.a. "Posix") language environment, looks like.
Somewhat strange, but maybe this is "usual" on macOS?

> > what is the output of "M-x describe-fontset RET fontset-default RET"
>     after evaluating set-language-environment, in particular in the
>     Emoji block starting from #x1F600?
> 
> 😀 .. 🙏 (#x1F600 .. #x1F64F)
>     -*-Apple Color Emoji-*-*-*-*-*-*-*-*-*-*-*-*
>     -*-Noto Color Emoji-*-*-*-*-*-*-*-*-*-*-iso10646-1
>     -*-Symbola-*-*-*-*-*-*-*-*-*-*-iso10646-1
> [-*-Symbola-normal-normal-semicondensed-*-12-*-*-*-p-0-iso10646-1]

It sounds like Emacs used Symbola, although Apple Color Emoji is in
the list, and is first in the list.  Which probably means Emacs
examined Apple Color Emoji and rejected it for some reason.

What happens if you evaluate

  (set-fontset-font "fontset-default" 'unicode "Apple Color Emoji" nil 'prepend)

again, after changing the language environment?

> >what did you mean by "emoji doesn't show up correctly"? how was it
>     displayed "incorrectly"?
> 
> The screenshots:
> - default: https://i.imgur.com/jLcwEDk.png
> - English with fontset(correctly): https://i.imgur.com/qgqhCHF.png
> - UTF-8 with fontset: https://i.imgur.com/tkjOVGv.png

AFAICT, this shows that "incorrect" means Emacs uses the Symbola font.

Does Apple Color Emoji on your system have glyphs for the #x1F300 and
#x1F600 characters?  Those are the characters we request to be
supported by a font that is used for emoji.