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

From: Stefan Monnier <[email-masked]>
Date: Thu, 08 Dec 2022 09:17:12 -0500

>> But when I specify the `weight` property of the `bold` face, it's not
>> clear at all that the `:family` of the default face should take precedence
>> over the `:weight` of the `bold` face.
>
> If we want to distinguish between explicitly requested attributes and
> inherited attributes, we need to store this information inside the
> font spec.  (We have the :user-spec attribute, but it is used for
> slightly different purposes.)

Indeed.

>> FWIW, I've been running with your patch and I like the result.
>
> Which patch is that?  The one proposed in the message to which you are
> responding, or one of the earlier ones?

See the hunk below.

> How would you determine the order in the stack?  IOW, which attributes
> will be "the first"?

For attributes specified directly in a face the relative order is not
specified, but attributes directly specified would come before
inherited attributes, and similarly when we merge several faces,
attributes from the first face would come before those of later faces.

        Stefan

@@ -3003,6 +3012,10 @@ font_find_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec, int
     }
   ASET (work, FONT_SIZE_INDEX, Qnil);
 
+  /* Also ignore the font weight, which when set leads to suboptimal
+     font choices.  See bug#59347.  */
+  ASET (work, FONT_WEIGHT_INDEX, Qnil);
+
   /* Foundry specification alternatives: from the most specific to the
      least specific and finally an unspecified one.  */
   foundry[0] = AREF (work, FONT_FOUNDRY_INDEX);