Subject: bug#12823: Invalid font name

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 Nov 2012 09:57:16 -0500

>> After letting xft use bitmap fonts on my system, Emacs started to crash,
>> which was tracked to an invalid font name that was used
>> without checking.
>> So I added
>>   if (NILP (spec))
>>     signal_error ("Invalid font name", ascii_font);
>> to x_set_font in revno 110704, but this only prevents the crash,
>> replacing it with an error.
> Do you mean this workaround as "assertion violations"?

No, I mean that without this NILP check, subsequent code "crashed" with an
assertion violation (due to assuming that `spec' is a string, IIRC).

> I think it just hides the deeper bug.  Here, SPEC is a return value of
> font_spec_from_name (fontset_ascii (fontset)), and font_spec_from_name
> should never fail with that kind of argument.

Right.

>> I'm still wondering about those names that include -, such as
>> "semi-condensed" that we have in font.c:
>> - IIUC, they can never be useful for XFLD font names.  Are they useful
>> for other font name formats supported by Emacs?  Examples?
>> - If they are useful sometimes, is it important to have the dashed
>> name first in the list?
> As I wrote before, the table is also used to get a face
> attribute value from a font spec, and, for instance, face
> attribute :width allows the symbol `semi-condensed'.

Sorry, I must have missed that message.  So we can't just remove those
dashed names.  Fine.

> If we don't have that name first in the list, we must have another
> index specifying which name is a valid face attribute value, or must
> have another tables that map numeric values of font spec to face
> attribute values.

My understanding is that this issue is only related to whether or not
`semi-condensed' is in the list, but is unrelated to whether it comes
before or after `semicondensed' in the list.

        Stefan