changeset 89352:ffa18ef18e45

(x_set_font, x_create_tip_frame): Adjusted to the change of x_new_fontset. (Fx_create_frame): Don't call x_new_fontset here. Just use x_list_fonts to check the existence of fonts.
author Kenichi Handa <handa@m17n.org>
date Fri, 10 Jan 2003 07:20:25 +0000
parents e12947259b11
children f1507fc0d6e6
files src/xfns.c
diffstat 1 files changed, 39 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Fri Jan 10 07:16:14 2003 +0000
+++ b/src/xfns.c	Fri Jan 10 07:20:25 2003 +0000
@@ -1988,8 +1988,8 @@
 
   BLOCK_INPUT;
   result = (STRINGP (fontset_name)
-	    ? x_new_fontset (f, XSTRING (fontset_name)->data)
-	    : x_new_fontset (f, XSTRING (arg)->data));
+	    ? x_new_fontset (f, fontset_name)
+	    : x_new_fontset (f, arg));
   UNBLOCK_INPUT;
   
   if (EQ (result, Qnil))
@@ -4424,31 +4424,42 @@
   {
     Lisp_Object font;
 
-    font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
-
-    BLOCK_INPUT;
-    /* First, try whatever font the caller has specified.  */
-    if (STRINGP (font))
-      font = x_new_fontset (f, XSTRING (font)->data);
-    
-    /* Try out a font which we hope has bold and italic variations.  */
-    if (!STRINGP (font))
-      font = x_new_fontset (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
+    font = x_get_arg (dpyinfo, parms, Qfont,
+		      "font", "Font", RES_TYPE_STRING);
+
+    /* If the caller has specified no font, try out fonts which we
+       hope have bold and italic variations.  */
     if (!STRINGP (font))
-      font = x_new_fontset (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
-    if (! STRINGP (font))
-      font = x_new_fontset (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
-    if (! STRINGP (font))
-      /* This was formerly the first thing tried, but it finds too many fonts
-	 and takes too long.  */
-      font = x_new_fontset (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
-    /* If those didn't work, look for something which will at least work.  */
-    if (! STRINGP (font))
-      font = x_new_fontset (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
-    UNBLOCK_INPUT;
-    if (! STRINGP (font))
-      font = build_string ("fixed");
-
+      {
+	char *names[]
+	  = { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
+	      "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
+	      "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
+	      /* This was formerly the first thing tried, but it finds
+		 too many fonts and takes too long.  */
+	      "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
+	      /* If those didn't work, look for something which will
+		 at least work.  */
+	      "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
+	      NULL };
+	int i;
+
+	BLOCK_INPUT;
+	for (i = 0; names[i]; i++)
+	  {
+	    Lisp_Object list;
+
+	    list = x_list_fonts (f, build_string (names[i]), 0, 1);
+	    if (CONSP (list))
+	      {
+		font = XCAR (list);
+		break;
+	      }
+	  }
+	UNBLOCK_INPUT;
+	if (! STRINGP (font))
+	  font = build_string ("fixed");
+      }
     x_default_parameter (f, parms, Qfont, font,
 			 "font", "Font", RES_TYPE_STRING);
   }
@@ -11019,9 +11030,9 @@
       {
 	tem = Fquery_fontset (font, Qnil);
 	if (STRINGP (tem))
-	  font = x_new_fontset (f, XSTRING (tem)->data);
+	  font = x_new_fontset (f, tem);
 	else
-	  font = x_new_font (f, XSTRING (font)->data);
+	  font = x_new_fontset (f, font);
       }
     
     /* Try out a font which we hope has bold and italic variations.  */