GNU bug report logs - #59347
29.0.50; `:family` face setting ignored

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 18 Nov 2022 04:58:01 UTC

Severity: normal

Found in version 29.0.50

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: monnier <at> iro.umontreal.ca, 59347 <at> debbugs.gnu.org
Subject: bug#59347: 29.0.50; `:family` face setting ignored
Date: Sun, 20 Nov 2022 15:35:06 +0000
>
> 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.  For many fonts (and 
for Emacs until recently), normal, regular and medium are the same weight.

>
> 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.

>
> It sounds like your patch is for another problem altogether.
>

I don't think so, at least my intention was to fix this bug (and also at 
least bug#57555, which is the same one).

>> +  /* If weight is "medium" in SPEC, also try "normal".  Fonts with an
>> +     explicit "medium" weight are much less common than fonts with an
>> +     explicit "normal" weight, and for a long time "medium" and
>> +     "normal" (a.k.a. "regular" a.k.a. "book") were synonymous in
>> +     Emacs.  See e.g. bug#59347 and bug#57555.  */
>> +  weight[0] = AREF (spec, FONT_WEIGHT_INDEX);
>> +  if (EQ (weight[0], Qmedium))
>> +    weight[1] = Qnormal, weight[2] = zero_vector;
>> +  else
>> +    weight[1] = zero_vector;
>
> 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.




This bug report was last modified 2 years and 160 days ago.

Previous Next


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