Subject: Re: bug#59347: 29.0.50; `:family` face setting ignored

From: Eli Zaretskii <[email-masked]>
Date: Thu, 08 Dec 2022 16:16:25 +0200

> Date: Thu, 08 Dec 2022 12:53:15 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked]
> 
> > The order on which we agreed is only about the numerical attributes: 
> > width, height, weight, and slant.  I'm asking about the other 
> > attributes, and about their importance relative to the numerical ones. 
> > You seem to say that this order is self-evident, and I'm questioning 
> > that.
> 
> Okay, now I see what you mean.  It is not self-evident indeed, it is the 
> intended behavior that is visible (or at least that I see) in the existing 
> code

Well, you just explained in so many words why some of the existing
code is wrong in your opinion, so arguments based on the existing code
are not very convincing...

> and it seems to me that it is the most natural behavior, because 
> changing the font itself, e.g. from DejaVu to Courier, has more effect / 
> creates more visual diversity than only changing the 
> width/height/weight/slant attributes, and in graphical user interfaces 
> more uniformity is better than more diversity.

You again seem to implicitly assume that the presence of the family
attribute means the caller must have that family or something close to
it.  But that needs not be the case, and OTOH the presence of some
other attribute, like weight, might by the same logic mean that the
caller must have that weight no matter the family.

> emacs -Q -fn 'Sans Serif-12:slant=oblique:width=condensed'
> 
> works as expected and behaves like Emacs 28: the font for the default face 
> is a condensed and oblique variable-pitch sans serif font.

And the size is indeed 12?

> Okay, so here is an updated patch.  To make it easier to investigate bugs 
> in this area, I think it makes sense to control each field separately, and 
> also to allow unsetting other attributes, which is what the new variable 
> does.

This is fine with me, although I tend to think that unsetting all the
attributes is too much.

> +  DEFVAR_INT ("realize-gui-face-ignored-spec-attributes",
> +	      realize_gui_face_ignored_spec_attributes,
> +	      doc: /* Ignored font-spec attributes in realize_gui_face.
> +
> +The value is an integer number and represents a bit mask.
> +The attribute corresponding to each bit that is set is cleared in
> +realize_gui_face.  The bits are: 1 = :foundry, 2 = :family,
> +3 = :adstyle, 4 = :registry, 5 = :weight, 6 = :slant, 7 = :width,
> +8 = :size, 9 = :dpi, 10 = :spacing, 11 = :avgwidth, 12 = extra
> +attributes (:name, :script, :lang and :otf).
> +
> +There is no reason to change that value except for debugging purposes.  */);

I suggest to describe the default value in the doc string, since
gleaning that from a (decimal) value displayed by Emacs by default is
not that easy.  Maybe also add a sentence which explains why that is
the default.

Thanks.