Mercurial > emacs
changeset 101293:558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
(font_parse_name): Treat a `?' character as part of an XLFD.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 19 Jan 2009 16:42:44 +0000 |
parents | ab308039742a |
children | f336a450a6e4 |
files | src/font.c |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/font.c Mon Jan 19 16:41:16 2009 +0000 +++ b/src/font.c Mon Jan 19 16:42:44 2009 +0000 @@ -1814,7 +1814,7 @@ 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 @@ 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]; - - args[0] = QCname; - args[1] = font_name; - return Ffont_spec (2, args); + Lisp_Object spec = Ffont_spec (0, NULL); + + 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; }