Subject: Re: bug#73752: 29.4; Ligatures are randomly rendered with extra spaces

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Nov 2024 20:27:44 +0200

> From: Visuwesh <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Sat, 02 Nov 2024 23:32:53 +0530
> 
> [சனி நவம்பர் 02, 2024] Visuwesh wrote:
> 
> > [சனி நவம்பர் 02, 2024] Eli Zaretskii wrote:
> >
> >> Ah, that explains the problem.  Then please change the breakpoint
> >> condition to say this instead, and re-run the experiment:
> >>
> >>  break hbfont.c:598 if xoff == 0 && yoff == 0 && wadjust ==
> >> metrics.width && ((struct Lisp_Object)LGLYPH_ADJUSTMENT(lglyph)).i
> >> != 0
> >
> > It doesn't break immediately anymore.  I will report back once the
> > breakpoint breaks.
> 
> I tried reproducing it again.  The misalignment occurred but the
> breakpoint was not triggered:
> 
>     (gdb) pgrow
>     TEXT: 4 glyphs
>       0    0: COMP[3457 (0..0)] pos=1 w=10 a+d=14+4 face=23 MB
>       1   10: COMP[3457 (1..1)] pos=2 w=10 a+d=14+4 face=23 MB
>       2   20: COMP[3457 (2..2)] pos=3 w=10 a+d=14+4 face=23 MB
>       3   30: CHAR[ ] pos=0 blev=0,btyp=B w=9 a+d=14+4 MB
>     (gdb) pp composition_gstring_from_id(3457)
>     [[#<font-object "-SAJA-Cascadia Code-bold-normal-normal-*-15-*-*-*-m-0-iso10646-1"> 45 45 62] 3457 [0 0 45 1970 9 0 9 7 -4 [0 0 10]] [1 1 45 1969 9 -1 10 7 -4 [0 0 10]] [2 2 62 2728 9 -1 9 11 0 [0 0 10]]]
> 
> where to get to type `pgrow' I said
> 
>     % kill -TSTP 222729
> 
> then set the breakpoint for set_cursor_from_row like you instructed
> earlier.
> 
> I can try to reproduce this issue once again to see if the breakpoint
> gets triggered.

Please also put a breakpoint in composite.c on the line shown below,
before you try reproducing again:

      if (NILP (glyph) || from != LGLYPH_FROM (glyph))
	{
	  eassert (i > 0);
	  Lisp_Object last = LGSTRING_GLYPH (gstring, i - 1);

	  if (width == 0)
	    {
	      if (NILP (LGLYPH_ADJUSTMENT (last)))  <<<<<<<<<<<<<<<<<<<<<
		LGLYPH_SET_ADJUSTMENT (last,
				       CALLN (Fvector,
					      make_fixnum (0), make_fixnum (0),
					      make_fixnum (LGLYPH_WIDTH (last)
							   + 1)));
	      else
		ASET (LGLYPH_ADJUSTMENT (last), 2,
		      make_fixnum (LGLYPH_WADJUST (last) + 1));
	    }