Subject: bug#52129: 29.0.50; Wish: Extend `:align-to center' to work on lines in buffer

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Nov 2021 07:59:33 +0200

> From: Arthur Miller <[email-masked]>
> Date: Fri, 26 Nov 2021 21:01:11 +0100
> 
> I am not sure if the title is descriptive enough, or even correct, but as seen
> from attached code and image, I am trying to align two strings in a center of
> each strings line.
> 
> It works now when string-pixel-width correctly calculates pixel widths. However,
> I would prefer if I could just use :align-to center as a spec for a string as
> property. Currently we have to use space as a spacer as we used to use
> gif-spacers back in time.
> 
> I am not sure about how semantics would work, there are several cases to
> consider, but generally if a string or a stretch of text in a string were given
> text property 'display '(:align-to center), then Emacs would align that stretch
> of text in the middle of the line that text occupies.

I don't understand what exactly are you asking for.  Is your problem
that you have to prepend some character to the string and put the
:align-to spec on that character?  Because AFAIU that simple measure
should achieve your goal.  If that's not what you want, or if what I
described doesn't work, please show some simple code to explain your
requests.