Subject: bug#49555: 28.0.50; height display property causes text to render with incorrect spacing

From: Eli Zaretskii <[email-masked]>
Date: Wed, 14 Jul 2021 15:55:29 +0300

> From: Adam Edge <[email-masked]>
> Date: Wed, 14 Jul 2021 01:27:22 +0300
> 
> I have encountered this bug while using lsp-ui mode. When a text is
> propertized with the display property `height', it is then displayed
> with the incorrect spacing. To test it, I have used this code:
> 
> (require 'lsp-ui)
> (let* ((text "Hello world")
>       (propertized (progn (add-face-text-property 0 (length text)
> 'lsp-ui-sideline-code-action nil text)
>                           text))
>       (overlay (make-overlay 1 1)))
>   (overlay-put overlay 'after-string (concat propertized
>                                         (propertize propertized 'display
> (lsp-ui-sideline--compute-height)))))
> 
> lsp-ui-sideline-code-action can be any face with a font with different
> spacing. In my Emacs configuration, it is defined as:
> 
> (font-spec :family "Fira Code" :size 14 :weight 'regular :spacing 100)
> 
> When the two "Hello world"s are displayed next to each other, the one
> which is propertized with the "height" property displays wider. In
> lsp-ui's case, this causes text to be cut off by the right side of the
> Emacs frame as it overflows (since the code actions are displayed as an
> overlay on the right side of the frame).

I'm a bit confused by the scenario description.  Could you perhaps
provide a simple self-contained recipe, which would not need any
third-party packages like lsp-ui, and could be invoked from "emacs -Q"?
It sounds like any references to lsp-ui in your scenario are not
really relevant, and just muddy the waters?

And what do you mean by "a font with a different spacing"? what is the
spacing of the default font in your case? and what is the default font
itself?

Thanks.