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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Nov 2022 17:54:27 +0200

> Date: Sun, 20 Nov 2022 15:35:06 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked]
> 
> > I'd prefer to delay the discussion of this until after Stefan has time 
> > to see why DejaVu Sans is rejected in his cases and describe his 
> > findings.
> >
> > If you already did that, please describe your findings.
> 
> It's described in the commit message.  DejaVu Sans is rejected because the 
> font of the default face has a 'medium' weight, and DejaVu Sans (like many 
> other fonts) does not explicitly support that weight.

Stefan said that he tried to change the weight, but that had no effect on
the problem.  So maybe what you see on your system is a different issue.

> > AFAIU, Stefan discovered that the problematic attribute was foundry, and 
> > and your patch does nothing about foundry.
> 
> I don't know how he reached that conclusion, but it's most likely not the 
> cause of the problem.

He described how he reached that conclusion in

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59347#65

> > This is not enough, IMO: you need to make sure the scoring of candidates 
> > is still correct.  For example, if the weights of two candidates differ 
> > (normal vs medium), but sizes are the same or close, how will that 
> > compare with candidates whose weights are identical, but sizes differ? 
> > IOW, we need to reconsider how font_score scores the candidates.
> >
> 
> I don't understand your question.  The patch essentially adds an inner 
> loop in the loop of fond_find_for_lface, to make sure that when weight == 
> medium, we call font_list_entities two times, first with
> 
> (family, foundry, registry, adstyle, weight == medium)
> 
> and then (if the previous call did not succeed to find a matching font, 
> IOW, if it did not return nil) with
> 
> (family, foundry, registry, adstyle, weight == normal)
> 
> There is no scoring involved at that point, AFAIU.

If we don't make font_score consistent with the change you made, we will
have other weird problems.  Maybe not in this particular case (although I'm
not sure even in this), but in others.