GNU bug report logs -
#78621
Pixelwise display specified spaces less precise than min-width
Previous Next
Reported by: Ship Mints <shipmints <at> gmail.com>
Date: Wed, 28 May 2025 19:46:01 UTC
Severity: normal
Tags: notabug
Done: Ship Mints <shipmints <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Wed, May 28, 2025 at 4:14 PM Jim Porter <jporterbugs <at> gmail.com> wrote:
> On 5/28/2025 12:44 PM, Ship Mints wrote:
> > You can see this in text-scaled buffers when attempting to pad a string
> > to a specific pixel boundary. If a pixelwise specified-width space is
> > inserted after a string with variable-pitch glyphs, it doesn't honor the
> > net pixel width. That same string padded using min-width with the same
> > number of pixels works fine.
>
> Are you sure that your implementation of 'string-pixel-width-scaled' is
> correct? From a brief look, I'd expect that you get some jitter when
> dividing '(default-font-width)' by '(frame-char-width)', since both are
> rounded to the nearest whole number.
>
> If I instead replace that call with:
>
> (string-pixel-width str (current-buffer))
>
> then everything looks ok to me. As of Emacs 31, passing a buffer does this:
>
> If BUFFER is non-nil, use the face remappings, alternative and default
> properties from that buffer when determining the width.
>
> That should handle all the necessary work to get the string width after
> applying text-scale remappings. I added that argument so I could use it
> in 'visual-wrap-prefix-mode' for a very similar issue you're seeing. See
> commit f70a6ea0ea86ef461e40d20664a75a92d02679ea.
>
Thanks for that. I think I'm using that in other places.
But... Did you run the repro in question and it worked for you, or are you
saying that this worked for your case?
AFAICT, the repro demonstrates a different issue. With the identical
string-pixel-width, padding using specified-width spaces vs. min-width
behave differently, so this isn't due to jitter as the widths used are the
same for both cases.
-Stephane
[Message part 2 (text/html, inline)]
This bug report was last modified 50 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.