bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30746: window-text-pixel-width includes width of following propertiz


From: Clément Pit-Claudel
Subject: bug#30746: window-text-pixel-width includes width of following propertized space
Date: Wed, 7 Mar 2018 17:13:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi all,

I'm trying to measure strings in an Emacs buffer.  The current code is yielding 
surprising results:

(progn
  (save-excursion
    (insert #("s " 1 2 (display (space :width (50))))))
  (window-text-pixel-size nil (point) (1+ (point))))

On my machine a single 's' is 8 pixels wide, but this snippet returns 58.  

The following snippet, however, returns 8 as expected:

(progn
  (save-excursion
    (insert "s "))
  (window-text-pixel-size nil (point) (1+ (point))))

It seems that adding a display property on the space changes the return value 
of window-text-pixel-size; is that expected?

Thanks,
Clément.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]