GNU bug report logs - #45920
28.0.50; set-face-attribute cannot read :family when different :weight exist

Previous Next

Package: emacs;

Reported by: Protesilaos Stavrou <info <at> protesilaos.com>

Date: Sat, 16 Jan 2021 20:11:01 UTC

Severity: normal

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45920 in the body.
You can then email your comments to 45920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#45920; Package emacs. (Sat, 16 Jan 2021 20:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Protesilaos Stavrou <info <at> protesilaos.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 16 Jan 2021 20:11:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; set-face-attribute cannot read :family when different
 :weight exist
Date: Sat, 16 Jan 2021 22:09:54 +0200
Dear maintainers,

I have noticed that setting fonts via 'set-face-attribute' works as
intended except in the following scenario (on 'emacs -Q'):

   ;; Sample 1
   (set-face-attribute 'default nil
                       :family "Source Code Pro"
                       :weight 'light)

   ;; Sample 2
   (set-face-attribute 'default nil
                       :family "Hack"
                       :weight 'normal)

If you evaluate sample 1, you will get the desired behaviour.  Namely,
the font family for the default face is the one specified, as is the
typographic weight.

Now if you proceed to evaluate sample 2, you will notice that only the
weight gets updated.  The family continues to be that of sample 1.

At this point, to get the family of sample 2, you need to evaluate
sample 2 one more time.

I tried various combinations and my impression is that the problem
occurs when the :weight properties are different.  Other properties,
such as :height, do not exhibit this behaviour.

Can you reproduce this on your end?

All the best,
Protesilaos

-- 
Protesilaos Stavrou
protesilaos.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45920; Package emacs. (Sat, 16 Jan 2021 20:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 45920 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 45920 <at> debbugs.gnu.org
Subject: Re: bug#45920: 28.0.50;
 set-face-attribute cannot read :family when different :weight exist
Date: Sat, 16 Jan 2021 22:25:43 +0200
> From: Protesilaos Stavrou <info <at> protesilaos.com>
> Date: Sat, 16 Jan 2021 22:09:54 +0200
> 
>    ;; Sample 1
>    (set-face-attribute 'default nil
>                        :family "Source Code Pro"
>                        :weight 'light)
> 
>    ;; Sample 2
>    (set-face-attribute 'default nil
>                        :family "Hack"
>                        :weight 'normal)
> 
> If you evaluate sample 1, you will get the desired behaviour.  Namely,
> the font family for the default face is the one specified, as is the
> typographic weight.
> 
> Now if you proceed to evaluate sample 2, you will notice that only the
> weight gets updated.  The family continues to be that of sample 1.
> 
> At this point, to get the family of sample 2, you need to evaluate
> sample 2 one more time.
> 
> I tried various combinations and my impression is that the problem
> occurs when the :weight properties are different.  Other properties,
> such as :height, do not exhibit this behaviour.

I didn't try to reproduce, because I don't have one of these fonts.
However, it might be relevant that when you call set-face-attribute
with several attributes related to the face's font, the underlying
primitive, internal-set-lisp-face-attribute, is called multiple time,
one time for every attribute.  So the order of those calls might
matter, especially if one of the fonts doesn't support some of the
values of all the attributes (e.g., the 'normal' weight in this case).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45920; Package emacs. (Sat, 16 Jan 2021 21:03:01 GMT) Full text and rfc822 format available.

Message #11 received at 45920 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 45920 <at> debbugs.gnu.org
Subject: Re: bug#45920: 28.0.50; set-face-attribute cannot read :family when
 different :weight exist
Date: Sat, 16 Jan 2021 23:02:24 +0200
On 2021-01-16, 22:25 +0200, Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Protesilaos Stavrou <info <at> protesilaos.com>
>> Date: Sat, 16 Jan 2021 22:09:54 +0200
>> 
>>    ;; Sample 1
>>    (set-face-attribute 'default nil
>>                        :family "Source Code Pro"
>>                        :weight 'light)
>> 
>>    ;; Sample 2
>>    (set-face-attribute 'default nil
>>                        :family "Hack"
>>                        :weight 'normal)
>> 
>> If you evaluate sample 1, you will get the desired behaviour.  Namely,
>> the font family for the default face is the one specified, as is the
>> typographic weight.
>> 
>> Now if you proceed to evaluate sample 2, you will notice that only the
>> weight gets updated.  The family continues to be that of sample 1.
>> 
>> At this point, to get the family of sample 2, you need to evaluate
>> sample 2 one more time.
>> 
>> I tried various combinations and my impression is that the problem
>> occurs when the :weight properties are different.  Other properties,
>> such as :height, do not exhibit this behaviour.
>
> I didn't try to reproduce, because I don't have one of these fonts.
> However, it might be relevant that when you call set-face-attribute
> with several attributes related to the face's font, the underlying
> primitive, internal-set-lisp-face-attribute, is called multiple time,
> one time for every attribute.  So the order of those calls might
> matter, especially if one of the fonts doesn't support some of the
> values of all the attributes (e.g., the 'normal' weight in this case).

Thank you Eli for the prompt reply!

Following your input, I tried alternating between those two and they
both give me the right results:

   (progn
     (internal-set-lisp-face-attribute 'default :family "Source Code Pro" 0)
     (internal-set-lisp-face-attribute 'default :weight 'light 0))
   
   (progn
     (internal-set-lisp-face-attribute 'default :weight 'normal 0)
     (internal-set-lisp-face-attribute 'default :family "Hack" 0))

Please feel free to close this.

-- 
Protesilaos Stavrou
protesilaos.com




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 17 Jan 2021 03:30:02 GMT) Full text and rfc822 format available.

Notification sent to Protesilaos Stavrou <info <at> protesilaos.com>:
bug acknowledged by developer. (Sun, 17 Jan 2021 03:30:02 GMT) Full text and rfc822 format available.

Message #16 received at 45920-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 45920-done <at> debbugs.gnu.org
Subject: Re: bug#45920: 28.0.50; set-face-attribute cannot read :family when
 different :weight exist
Date: Sun, 17 Jan 2021 05:29:20 +0200
> From: Protesilaos Stavrou <info <at> protesilaos.com>
> Cc: 45920 <at> debbugs.gnu.org
> Date: Sat, 16 Jan 2021 23:02:24 +0200
> 
> Following your input, I tried alternating between those two and they
> both give me the right results:
> 
>    (progn
>      (internal-set-lisp-face-attribute 'default :family "Source Code Pro" 0)
>      (internal-set-lisp-face-attribute 'default :weight 'light 0))
>    
>    (progn
>      (internal-set-lisp-face-attribute 'default :weight 'normal 0)
>      (internal-set-lisp-face-attribute 'default :family "Hack" 0))
> 
> Please feel free to close this.

Done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Feb 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.