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

From: Robert Pluim <[email-masked]>
Date: Wed, 22 Sep 2021 11:02:04 +0200

>>>>> On Tue, 21 Sep 2021 21:28:40 +0300, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Cc: [email-masked],  [email-masked],  [email-masked]
    >> Date: Tue, 21 Sep 2021 19:43:05 +0200
    >> 
    >> Eli, is this the kind of thing you were thinking of? Seems to work so
    >> far (with a small addition to blocks.awk).

    Eli> Yes, with a minor comment below.

    >> We'll need to find a better name for the new arg than 'trigger'
    >> though.

    Eli> How about just 'ch'?  We use such names all over the place, so
    Eli> describing what it is in the comment should be enough.

OK

    >> @@ -3912,6 +3916,23 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
    >> continue;
    >> if (NILP (font_object))
    >> {
    >> +	  if (EQ (CHAR_TABLE_REF (Vchar_script_table, trigger),
    >> +		  Qemoji))
    >> +	    {
    >> +	      Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars);
    >> +	      if (CONSP (val))
    >> +		{
    >> +		  int face_id;
    >> +		  val = XCDR (val);
    >> +		  if (CONSP (val))
    >> +		    val = XCAR (val);
    >> +		  else if (VECTORP (val))
    >> +		    val = AREF (val, 0);
    >> +		  c = XFIXNAT (val);
    >> +		  face_id = FACE_FOR_CHAR (f, face, c, pos - 1, string);
    >> +		  face = FACE_FROM_ID (f, face_id);
    >> +		}
    >> +	    }
    >> font_object = font_for_char (face, c, pos - 1, string);
    >> if (NILP (font_object))
    >> return Qnil;

    Eli> For backward compatibility, I'd prefer here, if font_for_char returns
    Eli> nil for the representative Emoji character, to call font_for_char
    Eli> again with the face and codepoint for the original character.

OK. I spoke a little too soon, itʼs not working 100% reliably,
sometimes the composition happens but the glyph for the preceding
codepoint is not from the emoji font.

Robert
--