Subject: Re: bug#52888: 29.0.50; font_{delete_unmatched,score} do not handle nil FONT_WEIGHT_INDEX

From: Sean Whitton <[email-masked]>
Date: Fri, 31 Dec 2021 19:35:53 -0700

Hello,

On Fri 31 Dec 2021 at 05:30PM -07, Sean Whitton wrote:

> The ftcrhb backend returns a FcPattern for each of the weights contained
> in Inconsolata-VariableFont_wdth,wght.ttf.  So Emacs does not need to
> learn anything special about these variable weight files in order to
> support them, I think.  However, this code in ftfont_pattern_entity can
> sometimes set FONT_WEIGHT_INDEX to nil:
>
>   if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch)
>     {
>       FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_fixnum (numeric));
>     }

... or FcPatternGetInteger returns something other than FcResultMatch,
which is in fact what is happening.

I tried FcPatternGetDouble in an else branch and that fails too, so it
seems fontconfig cannot determine a weight for the variant in question.

So, perhaps each of the if (FcPatternGetInteger (...)) conditionals that
corresponds to one of the FONT_* fields that the font.c functions assume
are fixnums should have an else branch to return Qnil?

-- 
Sean Whitton