all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Add a function that returns pixel distance between points?
@ 2021-01-30 20:47 Yuan Fu
  2021-01-31  3:31 ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Yuan Fu @ 2021-01-30 20:47 UTC (permalink / raw
  To: emacs-devel\@gnu.org

For aligning text according to their display size, I need to calculate the width of some text. Currently I’m using window-text-pixel-size, but it has some problem: if the text I’m measuring has line-prefix or wrap-prefix, the size returned will include the width of the prefix. So if the prefix is 14 pixels wide and the text is 7 pixels wide, the returned value is 21 instead of 7. Line number width is sometimes included in the result and sometimes not.

There is also posn-at-point but that requires the point to be visible in the window. My alignment function wants to run in jit-lock so point is not always visible, so I can’t use posn-at-point.


Yuan


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

end of thread, other threads:[~2021-02-05 15:48 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-30 20:47 Add a function that returns pixel distance between points? Yuan Fu
2021-01-31  3:31 ` Eli Zaretskii
2021-01-31  5:17   ` Yuan Fu
2021-01-31  5:52     ` Ihor Radchenko
2021-01-31 19:42       ` Yuan Fu
2021-01-31 15:24     ` Eli Zaretskii
2021-01-31 19:41       ` Yuan Fu
2021-01-31 20:13         ` Eli Zaretskii
2021-02-01 14:16           ` Yuan Fu
2021-02-01 18:22             ` Eli Zaretskii
2021-02-01 23:00               ` Yuan Fu
2021-02-02 16:29                 ` Eli Zaretskii
2021-02-03 15:04                   ` Eli Zaretskii
2021-02-03 16:48                     ` Yuan Fu
2021-02-04 16:02                       ` Eli Zaretskii
2021-02-05 10:15                         ` martin rudalics
2021-02-05 12:25                           ` Eli Zaretskii
2021-02-05 15:48                             ` martin rudalics

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.