Subject: bug#78621: Pixelwise display specified spaces less precise than min-width

From: Jim Porter <[email-masked]>
Date: Fri, 30 May 2025 13:01:30 -0700

On 5/29/2025 9:39 PM, Eli Zaretskii wrote:
> If the string's text is already in a buffer, we have
> buffer-text-pixel-size and window-text-pixel-size for that purpose.
> If the text is not in any buffer, then string-pixel-width should do
> the job, and do it well.  In particular, it strives to turn on/off all
> the features that affect display as they are in the original buffer
> (which can be passed to it as an optional argument), and applies all
> the buffer-local settings that could matter.  This includes face
> remapping (which is how text-scaling is implemented).
> 
> So I still don't understand the nature of the problem.

The problem was simply that the original script to reproduce the issue 
didn't pass the optional buffer argument to 'string-pixel-width', so the 
relevant buffer-local settings (face remapping) weren't used. Instead, 
the original script tried to approximate the remapping using its own 
calculations which weren't quite the same as the display engine.