all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Adam Edge <baronedge@airmail.cc>
To: 49555@debbugs.gnu.org
Subject: bug#49555: 28.0.50; height display property causes text to render with incorrect spacing
Date: Wed, 14 Jul 2021 19:00:25 +0300	[thread overview]
Message-ID: <8b780fd8-9fce-e9e7-a2a1-38a0e327a11a@airmail.cc> (raw)
In-Reply-To: <83a6mp837i.fsf@gnu.org>

On 7/14/21 3:55 PM, Eli Zaretskii wrote:
>> From: Adam Edge <baronedge@airmail.cc>
>> 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.
>
>
>

Thanks for your response. I am trying to come up with something that works
on emacs -Q. This is what I've come up with:

(setq my-font (font-spec :family "Fira Code" :size 14 :weight 'regular :spacing 100))
(set-frame-font my-font)
(set-face-attribute 'default t :font my-font)

(defface test-face '((t :inherit default))
  "A face for testing.")
(let* ((text "Hello world")
       (propertized (progn (add-face-text-property 0 (length text) 'test-face nil text)
			   text))
       (overlay (make-overlay 1 1)))
  (overlay-put overlay 'after-string (concat propertized "\n"
					     (propertize propertized 'display '(height 1)))))

Running this in the scratch buffer in emacs -Q produces two "Hello world"s,
the latter having more space between each letter and being slightly bolder
(which is not what I want).

Another thing I've noticed is that when I just did the (set-face-attribute)
part without (set-frame-font) and opened a new frame, the frame's font was
the same as the one with incorrect letter spacing. When I did
M-x describe-font RET, this is what I got in the `full name' line:Fira
Code:pixelsize=14:foundry=CTDB:weight=normal:slant=normal:width=normal:spacing=90:scalable=true
And the font loaded is: /usr/share/fonts/fira-code/FiraCode-Medium.ttf
After doing the (set-frame-font), the font returned to the desired
spacing. The `full-name' line in describe-font now is: Fira
Code:pixelsize=14:foundry=CTDB:weight=normal:slant=normal:width=normal:spacing=100:scalable=true
And the font loaded now is:
/home/aedge/.local/share/fonts/FiraCode-Retina.ttf I suppose removing
the system font should fix my problem here, and the issue can be closed,
but why does the font change when '(height 1) is specified?






  reply	other threads:[~2021-07-14 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 22:27 bug#49555: 28.0.50; height display property causes text to render with incorrect spacing Adam Edge
2021-07-14 12:55 ` Eli Zaretskii
2021-07-14 16:00   ` Adam Edge [this message]
2021-07-14 16:05     ` Adam Edge
2021-07-17 12:05     ` Eli Zaretskii
2021-07-17 12:15       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b780fd8-9fce-e9e7-a2a1-38a0e327a11a@airmail.cc \
    --to=baronedge@airmail.cc \
    --cc=49555@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.