Subject: Re: bug#25824: 25.1; bugs about display specfications

From: Eli Zaretskii <[email-masked]>
Date: Fri, 24 Feb 2017 10:23:13 +0200

> From: [email-masked]
> Cc: [email-masked]
> Date: Fri, 24 Feb 2017 15:01:19 +0900
> 
> Eli Zaretskii <[email-masked]> writes:
> > Only if the replacement comes from a before- or after-string (in which
> > case the text won't be replaced, so you will have to hide it with some
> > invisible property).  Put the 'raise' display property on the overlay
> > string, and you will have what you want.
> 
> Overlays are not editable with kill and yank,
> so text properties are better.

Then I'm afraid you are out of luck, because Emacs doesn't support
recursive 'display' properties, i.e. a 'display' property that is a
string which has another 'display' property for (a part of) that
string.

> > What the display engine does is reserve space above
> > the baseline that is large enough for the enlarged font, and then draw
> > the "X" with a negative offset relative to the baseline, by enlarging
> > the 'descent' value of that particular glyph, which adds vertical
> > space _below_ the line.
> 
> I wonder why the display engine does not take 'rase' into account
> when reserving space above the baseline.

AFAIU, it's just a side effect of the implementation: 'raise' is
implemented as modifications of the ascent or descent, so it behaves
like these attributes of any glyph would.

> > Does the below do what you want?  If not, perhaps I don't understand
> > what you mean by "centered".
> >
> >   (insert "A" (propertize "X" 'display '((raise -0.2) (height 2))))
> 
> It is enough for only one line.
> With blank areas, emacs can display fewer lines.

Yes, there are limitations of what can be done in Emacs as far as text
layout is concerned.