[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add a function that returns pixel distance between points?
From: |
Yuan Fu |
Subject: |
Add a function that returns pixel distance between points? |
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.
Yuan
- Add a function that returns pixel distance between points?,
Yuan Fu <=