[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Horizontal centering in the display engine
From: |
Eli Zaretskii |
Subject: |
Re: Horizontal centering in the display engine |
Date: |
Thu, 15 Apr 2021 10:04:51 +0300 |
> From: "Paul W. Rankin" <pwr@bydasein.com>
> Date: Thu, 15 Apr 2021 15:13:43 +1000
> Cc: Eli Zaretskii <eliz@gnu.org>,
> emacs-devel@gnu.org
>
> (defun center-align-line ()
> (let (line-width align-col)
> (setq line-width (- (line-end-position)
> (line-beginning-position)))
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.
- Re: Horizontal centering in the display engine, (continued)
- Re: Horizontal centering in the display engine, Eli Zaretskii, 2021/04/14
- Re: Horizontal centering in the display engine, sbaugh, 2021/04/14
- Re: Horizontal centering in the display engine, Yuan Fu, 2021/04/14
- Re: Horizontal centering in the display engine, Stefan Monnier, 2021/04/14
- Re: Horizontal centering in the display engine, sbaugh, 2021/04/14
- Re: Horizontal centering in the display engine, Eli Zaretskii, 2021/04/14
- Re: Horizontal centering in the display engine, sbaugh, 2021/04/14
- Re: Horizontal centering in the display engine, Eli Zaretskii, 2021/04/14
- Re: Horizontal centering in the display engine, martin rudalics, 2021/04/14
Re: Horizontal centering in the display engine, Paul W. Rankin, 2021/04/15
- Re: Horizontal centering in the display engine,
Eli Zaretskii <=