aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-01-19 16:41:16 +0000
committerChong Yidong2009-01-19 16:41:16 +0000
commit21bdb81a75a878d4e359d5049453d4e0a380b22c (patch)
tree19f4d8c498597df0a0b03a139b0aea5a08bbbb65
parent7f82490bfe2762b24247e1721ed6200f25985a54 (diff)
downloademacs-21bdb81a75a878d4e359d5049453d4e0a380b22c.tar.gz
emacs-21bdb81a75a878d4e359d5049453d4e0a380b22c.zip
(Finternal_set_lisp_face_attribute, Fx_list_fonts): Check return value of font_spec_from_name.
(Fx_list_fonts): Doc fix.
-rw-r--r--src/xfaces.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index f892d6bc58a..0e3e6861eca 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1816,11 +1816,13 @@ DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 5, 0,
1816 doc: /* Return a list of the names of available fonts matching PATTERN. 1816 doc: /* Return a list of the names of available fonts matching PATTERN.
1817If optional arguments FACE and FRAME are specified, return only fonts 1817If optional arguments FACE and FRAME are specified, return only fonts
1818the same size as FACE on FRAME. 1818the same size as FACE on FRAME.
1819PATTERN is a string, perhaps with wildcard characters; 1819
1820PATTERN should be a string containing a font name in the XLFD,
1821Fontconfig, or GTK format. A font name given in the XLFD format may
1822contain wildcard characters:
1820 the * character matches any substring, and 1823 the * character matches any substring, and
1821 the ? character matches any single character. 1824 the ? character matches any single character.
1822 PATTERN is case-insensitive. 1825 PATTERN is case-insensitive.
1823FACE is a face name--a symbol.
1824 1826
1825The return value is a list of strings, suitable as arguments to 1827The return value is a list of strings, suitable as arguments to
1826`set-face-font'. 1828`set-face-font'.
@@ -1892,6 +1894,9 @@ the WIDTH times as wide as FACE on FRAME. */)
1892 Lisp_Object args[2], tail; 1894 Lisp_Object args[2], tail;
1893 1895
1894 font_spec = font_spec_from_name (pattern); 1896 font_spec = font_spec_from_name (pattern);
1897 if (!FONTP (font_spec))
1898 signal_error ("Invalid font name", pattern);
1899
1895 if (size) 1900 if (size)
1896 { 1901 {
1897 Ffont_put (font_spec, QCsize, make_number (size)); 1902 Ffont_put (font_spec, QCsize, make_number (size));
@@ -3252,11 +3257,14 @@ FRAME 0 means change the face on all frames, and change the default
3252 { 3257 {
3253 if (STRINGP (value)) 3258 if (STRINGP (value))
3254 { 3259 {
3255 int fontset = fs_query_fontset (value, 0); 3260 Lisp_Object name = value;
3261 int fontset = fs_query_fontset (name, 0);
3256 3262
3257 if (fontset >= 0) 3263 if (fontset >= 0)
3258 value = fontset_ascii (fontset); 3264 name = fontset_ascii (fontset);
3259 value = font_spec_from_name (value); 3265 value = font_spec_from_name (name);
3266 if (!FONTP (value))
3267 signal_error ("Invalid font name", name);
3260 } 3268 }
3261 else 3269 else
3262 signal_error ("Invalid font or font-spec", value); 3270 signal_error ("Invalid font or font-spec", value);