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

From: Visuwesh <[email-masked]>
Date: Mon, 28 Oct 2024 09:56:13 +0530

[ஞாயிறு அக்டோபர் 27, 2024] Eli Zaretskii wrote:

>> Cc: [email-masked], [email-masked], [email-masked]
>> Date: Sun, 27 Oct 2024 19:19:48 +0200
>> From: Eli Zaretskii <[email-masked]>
>> 
>> It's quite clear from the image that the "misaligned" line uses a font
>> with a different slant/weight/height value.  If that is the reason, I
>> guess the problem is with composition caching, but why is that an
>> issue in real life?  Do real-life Lisp programs modify face font
>> attributes so frequently?

Real-life Lisp programs certainly do not change face font attributes so
often but I believe the script does it so to reproduce the issue
quickly.  In a regular Emacs session, it is enough for the same text to
be shown in different font sizes (as a consequence of using C-x C-+) and
font weights to eventually exhibit this misalignment IME.

> Or maybe I don't understand the original problem.  The bug report says
> "extra spaces", but eacg font has its own metrics of the SPC glyph, so
> highlighting a line with a given face can affect the metrics of the
> whitespace.  Why is this surprising?  Or what did I miss?

I do not understand the technical details but the width of the glyph
used to draw it is not the one that should be used for the underlying
font (weight, size, etc. included) which leads to this misalignment.

To make it more clear, let's say that =:= is shaped for a font X with a
specific weight, size, etc.  At a later point in time, the width of the
glyph corresponding to X is used to draw =:= with font Y of same family.
This leads to the observed misalignment AFAIU.