emacs-devel
[Top][All Lists]
Advanced

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

Re: Horizontal centering in the display engine


From: sbaugh
Subject: Re: Horizontal centering in the display engine
Date: Tue, 13 Apr 2021 16:49:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:
>> From: sbaugh@catern.com
>> To have centered text, I think I'd want to do something like
>> 
>> :align-to (- center (0.5 . line-size))
>> 
>> [...]
>> 
>> As far as I understand the documentation, there's no way to express
>> something like line-size currently? Maybe that could be easily added?
>
> We have window-text-pixel-size, isn't that what you want?

But that can't be used in a pixel specification, as far as I understand?

And anyway, I don't think that's right - as the Elisp manual says,
"window-text-pixel-size treats the text displayed in a window as a whole
and does not care about the size of individual lines."

> If that doesn't help, then I guess I'll ask you to describe the use
> case in more detail.

The behavior I want is what's described here:
https://en.wikipedia.org/wiki/Typographic_alignment#Centered

There's a picture on that page captioned "Centered text" which shows the
desired behavior.

> E.g., are you planning on centering each line separately, or
> everything together, or something else?

Each line separately.

> IOW, how did you envision you'd put the display property on each line?

The same display property would be applied to every line.

> and how does this work when the user types text to add more lines, or
> make a line longer than the window? etc. etc.

When they add more lines, those new lines are also centered.  If a line
is longer than the window, it's truncated or wrapped depending on
truncate-lines, word-wrap, etc., as usual.




reply via email to

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