Subject: Re: bug#44020: 28.0.50; Prefer selection of colour emoji fonts?

From: Robert Pluim <[email-masked]>
Date: Mon, 19 Oct 2020 21:00:03 +0200

>>>>> On Mon, 19 Oct 2020 21:52:13 +0300, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Cc: [email-masked],  [email-masked]
    >> Date: Mon, 19 Oct 2020 20:34:41 +0200
    >> 
    >> (set-fontset-font t 'emoji '("Apple Color Emoji . "iso1064601") nil
    >> 'prepend)
    >> 
    >> It *should* work as-is on GNU/Linux, but for some reason Emacs is
    >> completely refusing to use any Emoji fonts for me there. Itʼs possible
    >> Iʼve messed up my system somehow, since emacs-27 has the same issue,
    >> but Iʼm seeing some very suspicious results from
    >> ftcrfont_glyph_extents (the font average width is always 0), so perhaps
    >> we need to adjust our font code.

    Eli> Didn't someone say they can see color emoji on Cairo?

Lars said he could, and itʼs in the NEWS file, so it worked at some
point. I canʼt get either Noto Color Emoji nor Emoji One to work on
GNU/Linux, because the following code in font.c bugs out

  /* We always open a font of manageable size; i.e non-zero average
     width and height.  */
  for (psize = pixel_size; ; psize++)
    {
      font_object = driver_list->driver->open_font (f, entity, psize);
      if (NILP (font_object))
	return Qnil;
      font = XFONT_OBJECT (font_object);
      if (font->average_width > 0 && font->height > 0)
	break;
      /* Avoid an infinite loop.  */
      if (psize > pixel_size + 15)
	return Qnil; <====== here
    }

and thatʼs because font->average_width is always 0.

Robert
--