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

From: Ship Mints <[email-masked]>
Date: Fri, 30 May 2025 16:16:07 -0400

On Fri, May 30, 2025 at 4:01 PM Jim Porter <[email-masked]> wrote:

> 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.
>

Indeed.  To be fair, I was trying to make this work for Emacs < 31 but I
won't bother anymore.  The new features and all the bug fixes in vtable (a
lot of them), will be Emacs 31, IMO.