all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30746: window-text-pixel-width includes width of following propertized space
@ 2018-03-07 22:13 Clément Pit-Claudel
  2018-03-08 13:33 ` Eli Zaretskii
  2019-09-28 21:51 ` Stefan Kangas
  0 siblings, 2 replies; 6+ messages in thread
From: Clément Pit-Claudel @ 2018-03-07 22:13 UTC (permalink / raw)
  To: 30746


[-- Attachment #1.1: Type: text/plain, Size: 642 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-28 21:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07 22:13 bug#30746: window-text-pixel-width includes width of following propertized space Clément Pit-Claudel
2018-03-08 13:33 ` Eli Zaretskii
2018-03-16 14:09   ` Clément Pit-Claudel
2018-03-16 16:13     ` Eli Zaretskii
2018-03-16 20:49       ` Clément Pit-Claudel
2019-09-28 21:51 ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.