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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 27 Oct 2024 19:43:55 +0200

> Date: Sun, 27 Oct 2024 13:39:56 -0400
> Cc: [email-masked], [email-masked], [email-masked]
> From: Yixuan Chen <[email-masked]>
> 
> On 10/27/24 13:27, Eli Zaretskii wrote:
> > 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?
> 
> The problem is that the "space" being rendered is different in the 
> following two case:
> 
> - if the default font is set to a specific combination of attributes 
> (say 16, bold, normal) from start, it renders all the characters with 
> one version of spacing. Let's call this version of spacing the 
> "expected" spacing,
> - if the default font is some other combination of attributes (say 16, 
> regular, normal), and one line is set to the attribute of (16, bold, 
> normal). There is a **probability** that this line will render with a 
> different version of spacing than the "expected" spacing. In my setup, 
> this different spacing is extra wide.
> 
> Ultimately, I believe the following should be true: if one line is 
> rendered with **the same font face attributes**, it should always be 
> rendered in **the same way**, regardless when, where, and how its 
> attributes are assigned. This is not the case for emacs right now, and 
> thus I consider it a bug.

Sorry, I still don't understand.  Your code does

  (highlight-lines-matching-regexp (cdr face) (car face))

This potentially shows each line in a different face, and thus can
affect the metrics of the SPC character glyph which is what the
indentation is made of.  So why is this a problem, let alone a bug?