unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist
@ 2021-01-16 20:09 Protesilaos Stavrou
  2021-01-16 20:25 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Protesilaos Stavrou @ 2021-01-16 20:09 UTC (permalink / raw)
  To: 45920

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist
  2021-01-16 20:09 bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist Protesilaos Stavrou
@ 2021-01-16 20:25 ` Eli Zaretskii
  2021-01-16 21:02   ` Protesilaos Stavrou
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-01-16 20:25 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: 45920

> From: Protesilaos Stavrou <info@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).





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist
  2021-01-16 20:25 ` Eli Zaretskii
@ 2021-01-16 21:02   ` Protesilaos Stavrou
  2021-01-17  3:29     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Protesilaos Stavrou @ 2021-01-16 21:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 45920

On 2021-01-16, 22:25 +0200, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Protesilaos Stavrou <info@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist
  2021-01-16 21:02   ` Protesilaos Stavrou
@ 2021-01-17  3:29     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-01-17  3:29 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: 45920-done

> From: Protesilaos Stavrou <info@protesilaos.com>
> Cc: 45920@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-17  3:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-16 20:09 bug#45920: 28.0.50; set-face-attribute cannot read :family when different :weight exist Protesilaos Stavrou
2021-01-16 20:25 ` Eli Zaretskii
2021-01-16 21:02   ` Protesilaos Stavrou
2021-01-17  3:29     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).