GNU bug report logs - #76519
30.1; Unexpected Results from window-text-pixel-size

Previous Next

Package: emacs;

Reported by: AKIYAMA Kouhei <misohena <at> gmail.com>

Date: Mon, 24 Feb 2025 07:50:02 UTC

Severity: normal

Found in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 76519 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: AKIYAMA Kouhei <misohena <at> gmail.com>
Cc: 76519 <at> debbugs.gnu.org
Subject: Re: bug#76519: 30.1; Unexpected Results from window-text-pixel-size
Date: Wed, 26 Feb 2025 14:55:18 +0200
> From: AKIYAMA Kouhei <misohena <at> gmail.com>
> Date: Tue, 25 Feb 2025 20:24:07 +0900
> Cc: 76519 <at> debbugs.gnu.org
> 
> > By the way, is there any reason you didn't use string-pixel-width
> > instead? Or does it also have problems in this case?
> 
> The reason I did not use `string-pixel-width` is that I wanted to
> measure the width of text that includes icons and thumbnail images
> displayed via overlays (using the `after-string` and `before-string`
> properties). While the test case used a temporary buffer, in reality,
> the measurement was performed in a `dired-mode` buffer, and the timing
> was within `dired-after-readin-hook` (after `nerd-icons-dired` had
> added icons).

Yes, overlays cannot be part of a string, so string-pixel-width will
not do the job when the buffer text has overlay strings.

> By the way, while looking at the manual, I noticed that the arguments
> of the `buffer-text-pixel-size` function differ between the manual and
> Emacs itself.
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-of-Displayed-Text.html#index-buffer_002dtext_002dpixel_002dsize

Thanks, fixed.

> > > * Issue 2: Negative Width Returned When Full-Width Characters Are Present
> > >
> > > If the buffer contains full-width characters, `window-text-pixel-size`
> > > sometimes returns negative widths. This can be reproduced as follows:
> >
> > This was due to a stupid typo in the code, and is now fixed on the
> > release branch (to be merged to master in a few days).
> 
> You've already fixed it? Amazing!
> Thank you very much!

You're welcome.




This bug report was last modified 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.