|
From: | Paul W. Rankin |
Subject: | Re: Horizontal centering in the display engine |
Date: | Thu, 15 Apr 2021 21:39:59 +1000 |
User-agent: | Purely Mail via Roundcube/1.4.10 |
On 2021-04-15 17:04, Eli Zaretskii wrote:
This calculation of line-width is, of course, only valid when there's a single face used by the line's characters. Using window-text-pixel-size will produce more accurate results, but OP's main problem is not how to compute the line's width, it is how to make the alignment adjust itself automatically to any changes in the line's text and in the window's width.
Yes, just a proof of concept, we need to leave some things for OP to find out themselves ;)
If implemented with font-lock, the properties will automatically update when the text is changed, and a hook can be added to window-size-change-functions for the window changing.
[Prev in Thread] | Current Thread | [Next in Thread] |