Subject: bug#12823: Invalid font name

From: Stefan Monnier <[email-masked]>
Date: Wed, 07 Nov 2012 10:15:10 -0500

Package: Emacs
Version: 24.3.50

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.  Basically the error is that ascii_font is
not a valid XLFD font name because one of its fields has a "-" in its
name, and since fields are separated by "-", this leads to a misparse.

Now, this invalid name was built by Emacs, probably in
font_unparse_xlfd.  The appended patch fixes my problem.

So now the question is: should we reorder all the entries in the
width_table, slant_table, and weight_table so that the first entry of
every line is a non-dashed name?  Or could this have undesirable effects?

        Stefan

=== modified file 'src/font.c'
--- src/font.c	2012-11-06 03:17:56 +0000
+++ src/font.c	2012-11-07 15:04:24 +0000
@@ -102,7 +102,7 @@
   { 50, { "ultra-condensed", "ultracondensed" }},
   { 63, { "extra-condensed", "extracondensed" }},
   { 75, { "condensed", "compressed", "narrow" }},
-  { 87, { "semi-condensed", "semicondensed", "demicondensed" }},
+  { 87, { "semicondensed", "semi-condensed", "demicondensed" }},
   { 100, { "normal", "medium", "regular", "unspecified" }},
   { 113, { "semi-expanded", "semiexpanded", "demiexpanded" }},
   { 125, { "expanded" }},