Mercurial > emacs
comparison src/frame.c @ 94933:75fb6b489ec6
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.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 14 May 2008 01:34:57 +0000 |
parents | 722fdbc7a012 |
children | 8971ddf55736 |
comparison
equal
deleted
inserted
replaced
94932:4ac20761f264 | 94933:75fb6b489ec6 |
---|---|
36 #include "buffer.h" | 36 #include "buffer.h" |
37 /* These help us bind and responding to switch-frame events. */ | 37 /* These help us bind and responding to switch-frame events. */ |
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" |
52 #endif | 53 #endif |
53 | 54 |
54 | 55 |
55 #ifdef HAVE_WINDOW_SYSTEM | 56 #ifdef HAVE_WINDOW_SYSTEM |
56 | |
57 #ifdef USE_FONT_BACKEND | |
58 #include "font.h" | |
59 #endif /* USE_FONT_BACKEND */ | |
60 | 57 |
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 |
63 Lisp_Object Vx_resource_name; | 60 Lisp_Object Vx_resource_name; |
64 | 61 |
115 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; | 112 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; |
116 Lisp_Object Qtty_color_mode; | 113 Lisp_Object Qtty_color_mode; |
117 Lisp_Object Qtty, Qtty_type; | 114 Lisp_Object Qtty, Qtty_type; |
118 | 115 |
119 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; | 116 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; |
120 #ifdef USE_FONT_BACKEND | |
121 Lisp_Object Qfont_backend; | 117 Lisp_Object Qfont_backend; |
122 #endif /* USE_FONT_BACKEND */ | |
123 | 118 |
124 Lisp_Object Qinhibit_face_set_after_frame_default; | 119 Lisp_Object Qinhibit_face_set_after_frame_default; |
125 Lisp_Object Qface_set_after_frame_default; | 120 Lisp_Object Qface_set_after_frame_default; |
126 | 121 |
127 Lisp_Object Vterminal_frame; | 122 Lisp_Object Vterminal_frame; |
332 #ifdef HAVE_WINDOW_SYSTEM | 327 #ifdef HAVE_WINDOW_SYSTEM |
333 f->want_fullscreen = FULLSCREEN_NONE; | 328 f->want_fullscreen = FULLSCREEN_NONE; |
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) |
344 { | 337 { |
345 mini_window = make_window (); | 338 mini_window = make_window (); |
1466 This function must be called before the window tree of the | 1459 This function must be called before the window tree of the |
1467 frame is deleted because windows contain dynamically allocated | 1460 frame is deleted because windows contain dynamically allocated |
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. */ |
1478 delete_all_subwindows (XWINDOW (f->root_window)); | 1469 delete_all_subwindows (XWINDOW (f->root_window)); |
1479 f->root_window = Qnil; | 1470 f->root_window = Qnil; |
2833 {"line-spacing", &Qline_spacing}, | 2824 {"line-spacing", &Qline_spacing}, |
2834 {"left-fringe", &Qleft_fringe}, | 2825 {"left-fringe", &Qleft_fringe}, |
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 |
2844 | 2833 |
2845 extern Lisp_Object Qbox; | 2834 extern Lisp_Object Qbox; |
3345 void | 3334 void |
3346 x_set_font (f, arg, oldval) | 3335 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; |
3354 | 3341 Lisp_Object font_object; |
3355 #ifdef USE_FONT_BACKEND | 3342 |
3356 if (enable_font_backend) | 3343 /* Set the frame parameter back to the old value because we mail |
3357 { | 3344 fail to use ARG as the new parameter value. */ |
3358 int fontset = -1; | 3345 store_frame_param (f, Qfont, oldval); |
3359 Lisp_Object font_object; | 3346 |
3360 | 3347 /* ARG is a fontset name, a font name, or a font object. |
3361 /* ARG is a fontset name, a font name, or a font object. | 3348 In the last case, this function never fail. */ |
3362 In the last case, this function never fail. */ | 3349 if (STRINGP (arg)) |
3363 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 { | 3358 } |
3370 Lisp_Object ascii_font = fontset_ascii (fontset); | 3359 else if (fontset > 0) |
3371 | 3360 { |
3372 font_object = font_open_by_name (f, SDATA (ascii_font)); | 3361 Lisp_Object ascii_font = fontset_ascii (fontset); |
3373 } | 3362 |
3363 font_object = font_open_by_name (f, SDATA (ascii_font)); | |
3364 if (NILP (font_object)) | |
3365 error ("Font `%s' is not defined", SDATA (arg)); | |
3366 arg = fontset_name (fontset); | |
3374 } | 3367 } |
3375 else | 3368 else |
3376 font_object = arg; | 3369 error ("The default fontset can't be used for a frame font"); |
3377 | 3370 } |
3378 if (fontset < 0 && ! NILP (font_object)) | 3371 else if (FONT_OBJECT_P (arg)) |
3379 fontset = new_fontset_from_font (font_object); | 3372 { |
3380 | 3373 font_object = arg; |
3381 if (fontset == 0) | 3374 /* This is store the XLFD font name in the frame parameter for |
3382 /* Refuse the default fontset. */ | 3375 backward compatiblity. We should store the font-object |
3383 result = Qt; | 3376 itself in the future. */ |
3384 else if (NILP (font_object)) | 3377 arg = AREF (font_object, FONT_NAME_INDEX); |
3385 result = Qnil; | |
3386 else | |
3387 result = x_new_fontset2 (f, fontset, font_object); | |
3388 } | 3378 } |
3389 else | 3379 else |
3390 { | 3380 signal_error ("Invalid font", arg); |
3391 #endif /* USE_FONT_BACKEND */ | 3381 |
3392 CHECK_STRING (arg); | 3382 if (! NILP (Fequal (font_object, oldval))) |
3393 | 3383 return; |
3394 fontset_name = Fquery_fontset (arg, Qnil); | 3384 x_new_font (f, font_object, fontset); |
3395 | 3385 store_frame_param (f, Qfont, arg); |
3396 BLOCK_INPUT; | 3386 /* Recalculate toolbar height. */ |
3397 result = (STRINGP (fontset_name) | 3387 f->n_tool_bar_rows = 0; |
3398 ? x_new_fontset (f, fontset_name) | 3388 /* Ensure we redraw it. */ |
3399 : x_new_fontset (f, arg)); | 3389 clear_current_matrices (f); |
3400 UNBLOCK_INPUT; | 3390 |
3401 #ifdef USE_FONT_BACKEND | 3391 recompute_basic_faces (f); |
3402 } | |
3403 #endif | |
3404 | |
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 | |
3424 /* Recalculate toolbar height. */ | |
3425 f->n_tool_bar_rows = 0; | |
3426 /* Ensure we redraw it. */ | |
3427 clear_current_matrices (f); | |
3428 | |
3429 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 |
3436 /* Don't call `face-set-after-frame-default' when faces haven't been | 3395 /* Don't call `face-set-after-frame-default' when faces haven't been |
3437 initialized yet. This is the case when called from | 3396 initialized yet. This is the case when called from |
3444 call1 (Qface_set_after_frame_default, frame); | 3403 call1 (Qface_set_after_frame_default, frame); |
3445 } | 3404 } |
3446 } | 3405 } |
3447 | 3406 |
3448 | 3407 |
3449 #ifdef USE_FONT_BACKEND | |
3450 void | 3408 void |
3451 x_set_font_backend (f, new_value, old_value) | 3409 x_set_font_backend (f, new_value, old_value) |
3452 struct frame *f; | 3410 struct frame *f; |
3453 Lisp_Object new_value, old_value; | 3411 Lisp_Object new_value, old_value; |
3454 { | 3412 { |
3474 } | 3432 } |
3475 | 3433 |
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); |
3483 if (NILP (new_value)) | 3441 if (NILP (new_value)) |
3484 { | 3442 { |
3487 font_update_drivers (f, old_value); | 3445 font_update_drivers (f, old_value); |
3488 error ("None of specified font backends are available"); | 3446 error ("None of specified font backends are available"); |
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 |
3496 XSETFRAME (frame, f); | 3454 XSETFRAME (frame, f); |
3497 x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); | 3455 x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); |
3498 ++face_change_count; | 3456 ++face_change_count; |
3499 ++windows_or_buffers_changed; | 3457 ++windows_or_buffers_changed; |
3500 } | 3458 } |
3501 } | 3459 } |
3502 #endif /* USE_FONT_BACKEND */ | |
3503 | 3460 |
3504 | 3461 |
3505 void | 3462 void |
3506 x_set_fringe_width (f, new_value, old_value) | 3463 x_set_fringe_width (f, new_value, old_value) |
3507 struct frame *f; | 3464 struct frame *f; |