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

From: Tim Ruffing <[email-masked]>
Date: Thu, 31 Oct 2024 02:39:09 +0100

On Wed, 2024-10-30 at 20:57 +0200, Eli Zaretskii wrote:
> 
> 
> Then what exactly is the difference between the session with "good"
> display and the one with the "bad" display?  How come they show the
> same ligature differently?  What did you do to make them have
> different looks?

Nothing (that I'm aware of.) This appears to be non-deterministic.
Sometimes it works, sometimes it doesn't. And Yixuan seems to say the
same when he says that this looks like race condition.

It will still be useful to figure out what sets the [X-OFF Y-OFF
WADJUST] vectors instead of nil. After digging into the code a bit, I
strongly suspect it's composition_gstring_adjust_zero_width.

I'm not sure if I have the time to verify this in the coming days, I'd
appreciate if some of the other affected users could give it a try. 

I'm not claiming that composition_gstring_adjust_zero_width is wrong,
but if my theory is right that it sets the vector if and only if the
rendering is bad, then we'll be a step further.

This function was introduced in
cd88f6de4be1f8eba1db038b371d769f584be53b because of bug#50951. AFAIU it
is supposed to correct a grapheme width of 0 pixels to 1 pixel, so that
won't explain why large spaces are added. But I skimmed bug#50951 and
there are some mentions that composition_gstring_adjust_zero_width is
supposed to suppress adding the "space width of the font", which is
what some people see here, so all of this sounds a bit related. Next
question would be why emacs thinks that the grapheme width was zero in
the first place.

Tim