From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Edge Newsgroups: gmane.emacs.bugs Subject: bug#49555: 28.0.50; height display property causes text to render with incorrect spacing Date: Wed, 14 Jul 2021 19:05:11 +0300 Message-ID: <6998e563-d573-ee52-f536-83d176b879ac@airmail.cc> References: <83a6mp837i.fsf@gnu.org> <8b780fd8-9fce-e9e7-a2a1-38a0e327a11a@airmail.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23999"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 To: 49555@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 14 18:06:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3hOk-0005xE-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Jul 2021 18:06:12 +0200 Original-Received: from localhost ([::1]:32818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3hOj-0004HX-Ql for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Jul 2021 12:06:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3hNe-0002SR-Jv for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2021 12:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3hNe-0000Jw-Bi for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2021 12:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3hNd-0002W6-Tt for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2021 12:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adam Edge Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Jul 2021 16:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49555 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16262786979660 (code B ref -1); Wed, 14 Jul 2021 16:05:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jul 2021 16:04:57 +0000 Original-Received: from localhost ([127.0.0.1]:45790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3hNY-0002Vj-Uw for submit@debbugs.gnu.org; Wed, 14 Jul 2021 12:04:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3hNX-0002Vc-Sq for submit@debbugs.gnu.org; Wed, 14 Jul 2021 12:04:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3hNX-00026g-Mf for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2021 12:04:55 -0400 Original-Received: from mail.cock.li ([37.120.193.124]:53832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3hNU-000080-VK for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2021 12:04:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail; t=1626278685; bh=OXAaI0HOJSPv68KfdbC1knxCpAguPyzwS1/7IsqpAnE=; h=Subject:From:To:References:Date:In-Reply-To:From; b=U6d5GuqhTHBoTKKLXqj4qjtEm4pBcYagCBVL7VoJm4yPLS09NJeZ+nZ6p2NJNsG1c GlyA5tm8EksB3WjVQP6NbYpuPrxVL+v9i3Rsazbi77GA3ICxOH2QSu/mZCm6C6wNTT rPprZ1Y03I3eZfuztEcgtFZXgDsdqT9Nesw7qTJykeviDz/oLNVb5ULPa0gwbs0/Kc 0T7/S10duVKN4XeI0CR5lQL9e9xI2KqZa+05tQgf0rpHIwo9zkfuFv1x3P/vv/KZw2 5qoKdWRKC71icma1a/5iIJQRf1fXXV0+uDNoThKaPqHRthaE6XMoACivc3DS7feGHp NdEPIVw9fWk0A== In-Reply-To: <8b780fd8-9fce-e9e7-a2a1-38a0e327a11a@airmail.cc> Content-Language: en-US Received-SPF: pass client-ip=37.120.193.124; envelope-from=baronedge@airmail.cc; helo=mail.cock.li X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209959 Archived-At: On 7/14/21 7:00 PM, Adam Edge wrote: > On 7/14/21 3:55 PM, Eli Zaretskii wrote: >>> From: Adam Edge >>> 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? > I am sorry, for some reason the lines in my previous email got messed up, so I am reproducing them below; 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 file loaded was: /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?