Commit 05802645 authored by Chong Yidong's avatar Chong Yidong
Browse files

(font_spec_from_name): Return Qnil if font name could not be parsed.

(font_parse_name): Treat a `?' character as part of an XLFD.
parent 21bdb81a
......@@ -1814,7 +1814,7 @@ font_parse_name (name, font)
char *name;
Lisp_Object font;
{
if (name[0] == '-' || index (name, '*'))
if (name[0] == '-' || index (name, '*') || index (name, '?'))
return font_parse_xlfd (name, font);
return font_parse_fcname (name, font);
}
......@@ -3051,15 +3051,21 @@ font_get_spec (font_object)
return spec;
}
/* Create a new font spec from FONT_NAME, and return it. If FONT_NAME
could not be parsed by font_parse_name, return Qnil. */
Lisp_Object
font_spec_from_name (font_name)
Lisp_Object font_name;
{
Lisp_Object args[2];
Lisp_Object spec = Ffont_spec (0, NULL);
args[0] = QCname;
args[1] = font_name;
return Ffont_spec (2, args);
CHECK_STRING (font_name);
if (font_parse_name ((char *) SDATA (font_name), spec) == -1)
return Qnil;
font_put_extra (spec, QCname, font_name);
return spec;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment