Subject: Re: bug#65993: 29.1; emoji-insert show nothing without font settings

From: Eli Zaretskii <[email-masked]>
Date: Sat, 16 Sep 2023 09:47:57 +0300

> From: [email-masked]
> Cc: [email-masked]
> Date: Sat, 16 Sep 2023 15:12:42 +0900
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> And once emoji-insert is called before font setting,
> >> emoji-insert does not show emoji items after they are made visible in
> >> emacs buffer with font settings.
> >
> > This is not a bug: you need to clear the font cache to get Emacs to
> > react to newly-installed fonts without restarting Emacs.  Like this:
> >
> >   M-: (clear-font-cache) RET
> 
> Evaluating (clear-font-cache) have no effect on emoji-insert.
> Perhaps menu items are cached in another place.

Maybe.  You can also try clear-composition-cache.  If that doesn't
help either, just restart the session.  Installing new fonts and
reconfiguring fontsets while running Emacs is not fully supported, due
to many caches we have for fonts and compositions.

> >> Here is a sample setting to display emojis:
> >>   (set-fontset-font nil '(#x1f000 . #x1faff) "Segoe UI Emoji")
> >
> > Segoe UI Emoji is not a free font, so we cannot advertise it in Emacs.
> > You could tell Emacs about any fonts you have that support Emoji by
> > using the function w32-find-non-USB-fonts, see its doc string for
> > details.
> 
> Segoe UI was an only font for most of emojis installed in my PC.
> In this case, I think emacs should find the font by default.

It cannot, not without help (or opening each and every font, which
would be prohibitively expensive), because the fonts don't announce
support for Emoji in the Unicode Subset Bits, which are used on
Windows to decide which fonts support a given script.  That's why
Emacs has the w32-find-non-USB-fonts function: it configures the font
search algorithm to consider fonts that support scripts, such as
Emoji, which don't have those bits allocated to them.  You need to run
that function just once, and as long as you don't install new fonts,
you can keep its result in your .emacs.

> > In addition, Emacs 29 comes pre-configured to use the Noto Emoji font
> > on MS-Windows for showing Emoji, but you need to install that font
> > first.
> 
> Is Noto Color Emoji font is supported by emacs on MS-Windows?

No.  But Noto Emoji, the black-and-white variant, is supported, and
Emacs will use it for Emoji if it's installed.