emacs-devel
[Top][All Lists]
Advanced

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

Re: Add a function that returns pixel distance between points?


From: Eli Zaretskii
Subject: Re: Add a function that returns pixel distance between points?
Date: Sun, 31 Jan 2021 05:31:11 +0200

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 30 Jan 2021 15:47:38 -0500
> 
> 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.

Please explain what you mean by "align text according to display
size".  It isn't clear what you want to accomplish, and therefore the
full set of requirements and restrictions is not evident, which makes
it hard to provide useful advice.



reply via email to

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