comparison src/xfns.c @ 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 9feda646c377
children 2f877ed80fa6
comparison
equal deleted inserted replaced
89351:e12947259b11 89352:ffa18ef18e45
1986 1986
1987 fontset_name = Fquery_fontset (arg, Qnil); 1987 fontset_name = Fquery_fontset (arg, Qnil);
1988 1988
1989 BLOCK_INPUT; 1989 BLOCK_INPUT;
1990 result = (STRINGP (fontset_name) 1990 result = (STRINGP (fontset_name)
1991 ? x_new_fontset (f, XSTRING (fontset_name)->data) 1991 ? x_new_fontset (f, fontset_name)
1992 : x_new_fontset (f, XSTRING (arg)->data)); 1992 : x_new_fontset (f, arg));
1993 UNBLOCK_INPUT; 1993 UNBLOCK_INPUT;
1994 1994
1995 if (EQ (result, Qnil)) 1995 if (EQ (result, Qnil))
1996 error ("Font `%s' is not defined", XSTRING (arg)->data); 1996 error ("Font `%s' is not defined", XSTRING (arg)->data);
1997 else if (EQ (result, Qt)) 1997 else if (EQ (result, Qt))
4422 /* Extract the window parameters from the supplied values 4422 /* Extract the window parameters from the supplied values
4423 that are needed to determine window geometry. */ 4423 that are needed to determine window geometry. */
4424 { 4424 {
4425 Lisp_Object font; 4425 Lisp_Object font;
4426 4426
4427 font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); 4427 font = x_get_arg (dpyinfo, parms, Qfont,
4428 4428 "font", "Font", RES_TYPE_STRING);
4429 BLOCK_INPUT; 4429
4430 /* First, try whatever font the caller has specified. */ 4430 /* If the caller has specified no font, try out fonts which we
4431 if (STRINGP (font)) 4431 hope have bold and italic variations. */
4432 font = x_new_fontset (f, XSTRING (font)->data);
4433
4434 /* Try out a font which we hope has bold and italic variations. */
4435 if (!STRINGP (font)) 4432 if (!STRINGP (font))
4436 font = x_new_fontset (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); 4433 {
4437 if (!STRINGP (font)) 4434 char *names[]
4438 font = x_new_fontset (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); 4435 = { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
4439 if (! STRINGP (font)) 4436 "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
4440 font = x_new_fontset (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); 4437 "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
4441 if (! STRINGP (font)) 4438 /* This was formerly the first thing tried, but it finds
4442 /* This was formerly the first thing tried, but it finds too many fonts 4439 too many fonts and takes too long. */
4443 and takes too long. */ 4440 "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
4444 font = x_new_fontset (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); 4441 /* If those didn't work, look for something which will
4445 /* If those didn't work, look for something which will at least work. */ 4442 at least work. */
4446 if (! STRINGP (font)) 4443 "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
4447 font = x_new_fontset (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); 4444 NULL };
4448 UNBLOCK_INPUT; 4445 int i;
4449 if (! STRINGP (font)) 4446
4450 font = build_string ("fixed"); 4447 BLOCK_INPUT;
4451 4448 for (i = 0; names[i]; i++)
4449 {
4450 Lisp_Object list;
4451
4452 list = x_list_fonts (f, build_string (names[i]), 0, 1);
4453 if (CONSP (list))
4454 {
4455 font = XCAR (list);
4456 break;
4457 }
4458 }
4459 UNBLOCK_INPUT;
4460 if (! STRINGP (font))
4461 font = build_string ("fixed");
4462 }
4452 x_default_parameter (f, parms, Qfont, font, 4463 x_default_parameter (f, parms, Qfont, font,
4453 "font", "Font", RES_TYPE_STRING); 4464 "font", "Font", RES_TYPE_STRING);
4454 } 4465 }
4455 4466
4456 #ifdef USE_LUCID 4467 #ifdef USE_LUCID
11017 /* First, try whatever font the caller has specified. */ 11028 /* First, try whatever font the caller has specified. */
11018 if (STRINGP (font)) 11029 if (STRINGP (font))
11019 { 11030 {
11020 tem = Fquery_fontset (font, Qnil); 11031 tem = Fquery_fontset (font, Qnil);
11021 if (STRINGP (tem)) 11032 if (STRINGP (tem))
11022 font = x_new_fontset (f, XSTRING (tem)->data); 11033 font = x_new_fontset (f, tem);
11023 else 11034 else
11024 font = x_new_font (f, XSTRING (font)->data); 11035 font = x_new_fontset (f, font);
11025 } 11036 }
11026 11037
11027 /* Try out a font which we hope has bold and italic variations. */ 11038 /* Try out a font which we hope has bold and italic variations. */
11028 if (!STRINGP (font)) 11039 if (!STRINGP (font))
11029 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); 11040 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");