aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-05-14 01:34:57 +0000
committerKenichi Handa2008-05-14 01:34:57 +0000
commite0c8ad7833eda475af9b3becc23c150bb0fd6b90 (patch)
treea6f91d98d428d1579058a0c87d58f1df9dd8db42 /src
parenta952e54c4a2510de9592a48a187636576cd5f382 (diff)
downloademacs-e0c8ad7833eda475af9b3becc23c150bb0fd6b90.tar.gz
emacs-e0c8ad7833eda475af9b3becc23c150bb0fd6b90.zip
Throughout the file, delete all USE_FONT_BACKEND
conditionals. Don't check enable_font_backend. Delete all codes used only when USE_FONT_BACKEND is not defined. (x_set_font): Call x_new_font, not x_new_fontset2. (x_set_font_backend): Use FRAME_FONT macro to check if a font is already set for the frame.
Diffstat (limited to 'src')
-rw-r--r--src/frame.c137
1 files changed, 47 insertions, 90 deletions
diff --git a/src/frame.c b/src/frame.c
index 188e1d18717..fd9d527f647 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -38,14 +38,15 @@ Boston, MA 02110-1301, USA. */
38#include "commands.h" 38#include "commands.h"
39#include "keyboard.h" 39#include "keyboard.h"
40#include "frame.h" 40#include "frame.h"
41#ifdef HAVE_WINDOW_SYSTEM
42#include "fontset.h"
43#endif
44#include "blockinput.h" 41#include "blockinput.h"
45#include "termchar.h" 42#include "termchar.h"
46#include "termhooks.h" 43#include "termhooks.h"
47#include "dispextern.h" 44#include "dispextern.h"
48#include "window.h" 45#include "window.h"
46#ifdef HAVE_WINDOW_SYSTEM
47#include "font.h"
48#include "fontset.h"
49#endif
49#ifdef MSDOS 50#ifdef MSDOS
50#include "msdos.h" 51#include "msdos.h"
51#include "dosfns.h" 52#include "dosfns.h"
@@ -54,10 +55,6 @@ Boston, MA 02110-1301, USA. */
54 55
55#ifdef HAVE_WINDOW_SYSTEM 56#ifdef HAVE_WINDOW_SYSTEM
56 57
57#ifdef USE_FONT_BACKEND
58#include "font.h"
59#endif /* USE_FONT_BACKEND */
60
61/* The name we're using in resource queries. Most often "emacs". */ 58/* The name we're using in resource queries. Most often "emacs". */
62 59
63Lisp_Object Vx_resource_name; 60Lisp_Object Vx_resource_name;
@@ -117,9 +114,7 @@ Lisp_Object Qtty_color_mode;
117Lisp_Object Qtty, Qtty_type; 114Lisp_Object Qtty, Qtty_type;
118 115
119Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; 116Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
120#ifdef USE_FONT_BACKEND
121Lisp_Object Qfont_backend; 117Lisp_Object Qfont_backend;
122#endif /* USE_FONT_BACKEND */
123 118
124Lisp_Object Qinhibit_face_set_after_frame_default; 119Lisp_Object Qinhibit_face_set_after_frame_default;
125Lisp_Object Qface_set_after_frame_default; 120Lisp_Object Qface_set_after_frame_default;
@@ -334,10 +329,8 @@ make_frame (mini_p)
334#endif 329#endif
335 f->size_hint_flags = 0; 330 f->size_hint_flags = 0;
336 f->win_gravity = 0; 331 f->win_gravity = 0;
337#ifdef USE_FONT_BACKEND
338 f->font_driver_list = NULL; 332 f->font_driver_list = NULL;
339 f->font_data_list = NULL; 333 f->font_data_list = NULL;
340#endif /* USE_FONT_BACKEND */
341 334
342 root_window = make_window (); 335 root_window = make_window ();
343 if (mini_p) 336 if (mini_p)
@@ -1468,10 +1461,8 @@ But FORCE inhibits this too. */)
1468 memory. */ 1461 memory. */
1469 free_glyphs (f); 1462 free_glyphs (f);
1470 1463
1471#ifdef USE_FONT_BACKEND
1472 /* Give chance to each font driver to free a frame specific data. */ 1464 /* Give chance to each font driver to free a frame specific data. */
1473 font_update_drivers (f, Qnil); 1465 font_update_drivers (f, Qnil);
1474#endif /* USE_FONT_BACKEND */
1475 1466
1476 /* Mark all the windows that used to be on FRAME as deleted, and then 1467 /* Mark all the windows that used to be on FRAME as deleted, and then
1477 remove the reference to them. */ 1468 remove the reference to them. */
@@ -2835,9 +2826,7 @@ static struct frame_parm_table frame_parms[] =
2835 {"right-fringe", &Qright_fringe}, 2826 {"right-fringe", &Qright_fringe},
2836 {"wait-for-wm", &Qwait_for_wm}, 2827 {"wait-for-wm", &Qwait_for_wm},
2837 {"fullscreen", &Qfullscreen}, 2828 {"fullscreen", &Qfullscreen},
2838#ifdef USE_FONT_BACKEND
2839 {"font-backend", &Qfont_backend} 2829 {"font-backend", &Qfont_backend}
2840#endif /* USE_FONT_BACKEND */
2841}; 2830};
2842 2831
2843#ifdef HAVE_WINDOW_SYSTEM 2832#ifdef HAVE_WINDOW_SYSTEM
@@ -3347,89 +3336,59 @@ x_set_font (f, arg, oldval)
3347 struct frame *f; 3336 struct frame *f;
3348 Lisp_Object arg, oldval; 3337 Lisp_Object arg, oldval;
3349{ 3338{
3350 Lisp_Object result;
3351 Lisp_Object fontset_name;
3352 Lisp_Object frame; 3339 Lisp_Object frame;
3353 int old_fontset = FRAME_FONTSET(f); 3340 int fontset = -1;
3341 Lisp_Object font_object;
3354 3342
3355#ifdef USE_FONT_BACKEND 3343 /* Set the frame parameter back to the old value because we mail
3356 if (enable_font_backend) 3344 fail to use ARG as the new parameter value. */
3357 { 3345 store_frame_param (f, Qfont, oldval);
3358 int fontset = -1;
3359 Lisp_Object font_object;
3360 3346
3361 /* ARG is a fontset name, a font name, or a font object. 3347 /* ARG is a fontset name, a font name, or a font object.
3362 In the last case, this function never fail. */ 3348 In the last case, this function never fail. */
3363 if (STRINGP (arg)) 3349 if (STRINGP (arg))
3350 {
3351 fontset = fs_query_fontset (arg, 0);
3352 if (fontset < 0)
3364 { 3353 {
3365 fontset = fs_query_fontset (arg, 0); 3354 font_object = font_open_by_name (f, SDATA (arg));
3366 if (fontset < 0) 3355 if (NILP (font_object))
3367 font_object = font_open_by_name (f, SDATA (arg)); 3356 error ("Font `%s' is not defined", SDATA (arg));
3368 else if (fontset > 0) 3357 arg = AREF (font_object, FONT_NAME_INDEX);
3369 {
3370 Lisp_Object ascii_font = fontset_ascii (fontset);
3371
3372 font_object = font_open_by_name (f, SDATA (ascii_font));
3373 }
3374 } 3358 }
3375 else 3359 else if (fontset > 0)
3376 font_object = arg; 3360 {
3377 3361 Lisp_Object ascii_font = fontset_ascii (fontset);
3378 if (fontset < 0 && ! NILP (font_object))
3379 fontset = new_fontset_from_font (font_object);
3380 3362
3381 if (fontset == 0) 3363 font_object = font_open_by_name (f, SDATA (ascii_font));
3382 /* Refuse the default fontset. */ 3364 if (NILP (font_object))
3383 result = Qt; 3365 error ("Font `%s' is not defined", SDATA (arg));
3384 else if (NILP (font_object)) 3366 arg = fontset_name (fontset);
3385 result = Qnil; 3367 }
3386 else 3368 else
3387 result = x_new_fontset2 (f, fontset, font_object); 3369 error ("The default fontset can't be used for a frame font");
3388 } 3370 }
3389 else 3371 else if (FONT_OBJECT_P (arg))
3390 { 3372 {
3391#endif /* USE_FONT_BACKEND */ 3373 font_object = arg;
3392 CHECK_STRING (arg); 3374 /* This is store the XLFD font name in the frame parameter for
3393 3375 backward compatiblity. We should store the font-object
3394 fontset_name = Fquery_fontset (arg, Qnil); 3376 itself in the future. */
3395 3377 arg = AREF (font_object, FONT_NAME_INDEX);
3396 BLOCK_INPUT;
3397 result = (STRINGP (fontset_name)
3398 ? x_new_fontset (f, fontset_name)
3399 : x_new_fontset (f, arg));
3400 UNBLOCK_INPUT;
3401#ifdef USE_FONT_BACKEND
3402 } 3378 }
3403#endif 3379 else
3404 3380 signal_error ("Invalid font", arg);
3405 if (EQ (result, Qnil))
3406 error ("Font `%s' is not defined", SDATA (arg));
3407 else if (EQ (result, Qt))
3408 error ("The default fontset can't be used for a frame font");
3409 else if (STRINGP (result))
3410 {
3411 set_default_ascii_font (result);
3412 if (STRINGP (fontset_name))
3413 {
3414 /* Fontset names are built from ASCII font names, so the
3415 names may be equal despite there was a change. */
3416 if (old_fontset == FRAME_FONTSET (f))
3417 return;
3418 }
3419 store_frame_param (f, Qfont, result);
3420
3421 if (!NILP (Fequal (result, oldval)))
3422 return;
3423 3381
3424 /* Recalculate toolbar height. */ 3382 if (! NILP (Fequal (font_object, oldval)))
3425 f->n_tool_bar_rows = 0; 3383 return;
3426 /* Ensure we redraw it. */ 3384 x_new_font (f, font_object, fontset);
3427 clear_current_matrices (f); 3385 store_frame_param (f, Qfont, arg);
3386 /* Recalculate toolbar height. */
3387 f->n_tool_bar_rows = 0;
3388 /* Ensure we redraw it. */
3389 clear_current_matrices (f);
3428 3390
3429 recompute_basic_faces (f); 3391 recompute_basic_faces (f);
3430 }
3431 else
3432 abort ();
3433 3392
3434 do_pending_window_change (0); 3393 do_pending_window_change (0);
3435 3394
@@ -3446,7 +3405,6 @@ x_set_font (f, arg, oldval)
3446} 3405}
3447 3406
3448 3407
3449#ifdef USE_FONT_BACKEND
3450void 3408void
3451x_set_font_backend (f, new_value, old_value) 3409x_set_font_backend (f, new_value, old_value)
3452 struct frame *f; 3410 struct frame *f;
@@ -3476,7 +3434,7 @@ x_set_font_backend (f, new_value, old_value)
3476 if (! NILP (old_value) && ! NILP (Fequal (old_value, new_value))) 3434 if (! NILP (old_value) && ! NILP (Fequal (old_value, new_value)))
3477 return; 3435 return;
3478 3436
3479 if (FRAME_FONT_OBJECT (f)) 3437 if (FRAME_FONT (f))
3480 free_all_realized_faces (Qnil); 3438 free_all_realized_faces (Qnil);
3481 3439
3482 new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value); 3440 new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value);
@@ -3489,7 +3447,7 @@ x_set_font_backend (f, new_value, old_value)
3489 } 3447 }
3490 store_frame_param (f, Qfont_backend, new_value); 3448 store_frame_param (f, Qfont_backend, new_value);
3491 3449
3492 if (FRAME_FONT_OBJECT (f)) 3450 if (FRAME_FONT (f))
3493 { 3451 {
3494 Lisp_Object frame; 3452 Lisp_Object frame;
3495 3453
@@ -3499,7 +3457,6 @@ x_set_font_backend (f, new_value, old_value)
3499 ++windows_or_buffers_changed; 3457 ++windows_or_buffers_changed;
3500 } 3458 }
3501} 3459}
3502#endif /* USE_FONT_BACKEND */
3503 3460
3504 3461
3505void 3462void