Subject: Re: bug#61196: 30.0.50; X11 rendering of horizontal line in log-edit mode fails with some fonts

From: Eli Zaretskii <[email-masked]>
Date: Wed, 01 Feb 2023 14:19:01 +0200

> From: Po Lu <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 01 Feb 2023 11:42:27 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Cc: [email-masked]
> >> Date: Wed, 01 Feb 2023 09:29:08 +0800
> >> From:  Po Lu via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >> 
> >> When I last investigated this problem (I use the X core font backend all
> >> the time), it was that X fonts typically have no glyph for the newline
> >> character, which Emacs seems to expect.
> >
> > No, Emacs doesn't use the glyph for newline.  It starts a new screen
> > line instead.  But that requires the default face to have a valid
> > font, AFAIU.
> 
> Well, when I made xfont_has_char and xfont_encode_char return a working
> glyph for newline, that started working as expected.
> 
> But it's been so long that I've forgotten the details.

Or maybe I'm missing something: I don't really see the problem with
the newline character, I see the same problem with other (ASCII)
characters.  And there's this part of gui_produce_glyphs, which is
done before Emacs even considers what kind of character it has to
display:

  void
  gui_produce_glyphs (struct it *it)
  {
    int extra_line_spacing = it->extra_line_spacing;

    it->glyph_not_available_p = false;

    if (it->what == IT_CHARACTER)
      {
	unsigned char2b;
	struct face *face = FACE_FROM_ID (it->f, it->face_id);
	struct font *font = face->font;
	struct font_metrics *pcm = NULL;
	int boff;			/* Baseline offset.  */

	if (font == NULL)
	  {
	    /* When no suitable font is found, display this character by
	       the method specified in the first extra slot of
	       Vglyphless_char_display.  */
	    Lisp_Object acronym = lookup_glyphless_char_display (-1, it);

	    eassert (it->what == IT_GLYPHLESS);
	    produce_glyphless_glyph (it, true,
				     STRINGP (acronym) ? acronym : Qnil);
	    goto done;
	  }