diff options
| author | Kenichi Handa | 2008-05-14 01:04:51 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-05-14 01:04:51 +0000 |
| commit | 1cc06b86c488cc663a4474f3338f0aa7c62e80da (patch) | |
| tree | 13ee0991acc7d943385d7f95cfe598a4bb1f2c25 | |
| parent | 7a9ef2ed880e2d5a456f18d5d6026f6c29454f95 (diff) | |
| download | emacs-1cc06b86c488cc663a4474f3338f0aa7c62e80da.tar.gz emacs-1cc06b86c488cc663a4474f3338f0aa7c62e80da.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. Surround non-used
code by "#ifdef OLD_FONT" and "endif".
(Fw32_select_font): Use FONT_COMPAT to get old font structure.
| -rw-r--r-- | src/w32fns.c | 142 |
1 files changed, 35 insertions, 107 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 8b49c1e8a7d..980ebf46470 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -62,9 +62,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 62 | #include <imm.h> | 62 | #include <imm.h> |
| 63 | #define FILE_NAME_TEXT_FIELD edt1 | 63 | #define FILE_NAME_TEXT_FIELD edt1 |
| 64 | 64 | ||
| 65 | #ifdef USE_FONT_BACKEND | ||
| 66 | #include "font.h" | 65 | #include "font.h" |
| 67 | #endif | 66 | #include "w32font.h" |
| 68 | 67 | ||
| 69 | void syms_of_w32fns (); | 68 | void syms_of_w32fns (); |
| 70 | void globals_of_w32fns (); | 69 | void globals_of_w32fns (); |
| @@ -74,7 +73,9 @@ extern double atof (); | |||
| 74 | extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); | 73 | extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); |
| 75 | extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); | 74 | extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); |
| 76 | extern void w32_free_menu_strings P_ ((HWND)); | 75 | extern void w32_free_menu_strings P_ ((HWND)); |
| 76 | #if OLD_FONT | ||
| 77 | extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); | 77 | extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); |
| 78 | #endif | ||
| 78 | 79 | ||
| 79 | extern int quit_char; | 80 | extern int quit_char; |
| 80 | 81 | ||
| @@ -342,10 +343,8 @@ extern HMENU current_popup_menu; | |||
| 342 | static int menubar_in_use = 0; | 343 | static int menubar_in_use = 0; |
| 343 | 344 | ||
| 344 | /* From w32uniscribe.c */ | 345 | /* From w32uniscribe.c */ |
| 345 | #ifdef USE_FONT_BACKEND | ||
| 346 | extern void syms_of_w32uniscribe (); | 346 | extern void syms_of_w32uniscribe (); |
| 347 | extern int uniscribe_available; | 347 | extern int uniscribe_available; |
| 348 | #endif | ||
| 349 | 348 | ||
| 350 | /* Function prototypes for hourglass support. */ | 349 | /* Function prototypes for hourglass support. */ |
| 351 | static void show_hourglass P_ ((struct frame *)); | 350 | static void show_hourglass P_ ((struct frame *)); |
| @@ -4270,7 +4269,6 @@ unwind_create_frame (frame) | |||
| 4270 | return Qnil; | 4269 | return Qnil; |
| 4271 | } | 4270 | } |
| 4272 | 4271 | ||
| 4273 | #ifdef USE_FONT_BACKEND | ||
| 4274 | static void | 4272 | static void |
| 4275 | x_default_font_parameter (f, parms) | 4273 | x_default_font_parameter (f, parms) |
| 4276 | struct frame *f; | 4274 | struct frame *f; |
| @@ -4301,7 +4299,6 @@ x_default_font_parameter (f, parms) | |||
| 4301 | } | 4299 | } |
| 4302 | x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); | 4300 | x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); |
| 4303 | } | 4301 | } |
| 4304 | #endif | ||
| 4305 | 4302 | ||
| 4306 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | 4303 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
| 4307 | 1, 1, 0, | 4304 | 1, 1, 0, |
| @@ -4444,58 +4441,15 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4444 | f->resx = dpyinfo->resx; | 4441 | f->resx = dpyinfo->resx; |
| 4445 | f->resy = dpyinfo->resy; | 4442 | f->resy = dpyinfo->resy; |
| 4446 | 4443 | ||
| 4447 | #ifdef USE_FONT_BACKEND | 4444 | if (uniscribe_available) |
| 4448 | if (enable_font_backend) | 4445 | register_font_driver (&uniscribe_font_driver, f); |
| 4449 | { | 4446 | register_font_driver (&w32font_driver, f); |
| 4450 | /* Perhaps, we must allow frame parameter, say `font-backend', | ||
| 4451 | to specify which font backends to use. */ | ||
| 4452 | if (uniscribe_available) | ||
| 4453 | register_font_driver (&uniscribe_font_driver, f); | ||
| 4454 | register_font_driver (&w32font_driver, f); | ||
| 4455 | |||
| 4456 | x_default_parameter (f, parameters, Qfont_backend, Qnil, | ||
| 4457 | "fontBackend", "FontBackend", RES_TYPE_STRING); | ||
| 4458 | } | ||
| 4459 | #endif /* USE_FONT_BACKEND */ | ||
| 4460 | 4447 | ||
| 4448 | x_default_parameter (f, parameters, Qfont_backend, Qnil, | ||
| 4449 | "fontBackend", "FontBackend", RES_TYPE_STRING); | ||
| 4461 | /* Extract the window parameters from the supplied values | 4450 | /* Extract the window parameters from the supplied values |
| 4462 | that are needed to determine window geometry. */ | 4451 | that are needed to determine window geometry. */ |
| 4463 | #ifdef USE_FONT_BACKEND | 4452 | x_default_font_parameter (f, parameters); |
| 4464 | if (enable_font_backend) | ||
| 4465 | x_default_font_parameter (f, parameters); | ||
| 4466 | else | ||
| 4467 | #endif | ||
| 4468 | { | ||
| 4469 | Lisp_Object font; | ||
| 4470 | |||
| 4471 | font = w32_get_arg (parameters, Qfont, "font", "Font", RES_TYPE_STRING); | ||
| 4472 | |||
| 4473 | BLOCK_INPUT; | ||
| 4474 | /* First, try whatever font the caller has specified. */ | ||
| 4475 | if (STRINGP (font)) | ||
| 4476 | { | ||
| 4477 | tem = Fquery_fontset (font, Qnil); | ||
| 4478 | if (STRINGP (tem)) | ||
| 4479 | font = x_new_fontset (f, tem); | ||
| 4480 | else | ||
| 4481 | font = x_new_font (f, SDATA (font)); | ||
| 4482 | } | ||
| 4483 | /* Try out a font which we hope has bold and italic variations. */ | ||
| 4484 | if (!STRINGP (font)) | ||
| 4485 | font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); | ||
| 4486 | if (! STRINGP (font)) | ||
| 4487 | font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); | ||
| 4488 | /* If those didn't work, look for something which will at least work. */ | ||
| 4489 | if (! STRINGP (font)) | ||
| 4490 | font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); | ||
| 4491 | UNBLOCK_INPUT; | ||
| 4492 | if (! STRINGP (font)) | ||
| 4493 | font = build_string ("Fixedsys"); | ||
| 4494 | |||
| 4495 | x_default_parameter (f, parameters, Qfont, font, | ||
| 4496 | "font", "Font", RES_TYPE_STRING); | ||
| 4497 | } | ||
| 4498 | |||
| 4499 | x_default_parameter (f, parameters, Qborder_width, make_number (2), | 4453 | x_default_parameter (f, parameters, Qborder_width, make_number (2), |
| 4500 | "borderWidth", "BorderWidth", RES_TYPE_NUMBER); | 4454 | "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
| 4501 | /* This defaults to 2 in order to match xterm. We recognize either | 4455 | /* This defaults to 2 in order to match xterm. We recognize either |
| @@ -4683,6 +4637,8 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, | |||
| 4683 | } | 4637 | } |
| 4684 | 4638 | ||
| 4685 | 4639 | ||
| 4640 | #if OLD_FONT | ||
| 4641 | |||
| 4686 | /* Return the charset portion of a font name. */ | 4642 | /* Return the charset portion of a font name. */ |
| 4687 | char * | 4643 | char * |
| 4688 | xlfd_charset_of_font (char * fontname) | 4644 | xlfd_charset_of_font (char * fontname) |
| @@ -5008,6 +4964,7 @@ w32_unload_font (dpyinfo, font) | |||
| 5008 | xfree (font); | 4964 | xfree (font); |
| 5009 | } | 4965 | } |
| 5010 | } | 4966 | } |
| 4967 | #endif /* OLD_FONT */ | ||
| 5011 | 4968 | ||
| 5012 | /* The font conversion stuff between x and w32 */ | 4969 | /* The font conversion stuff between x and w32 */ |
| 5013 | 4970 | ||
| @@ -5506,6 +5463,8 @@ w32_to_all_x_charsets (fncharset) | |||
| 5506 | } | 5463 | } |
| 5507 | } | 5464 | } |
| 5508 | 5465 | ||
| 5466 | #if OLD_FONT | ||
| 5467 | |||
| 5509 | /* Get the Windows codepage corresponding to the specified font. The | 5468 | /* Get the Windows codepage corresponding to the specified font. The |
| 5510 | charset info in the font name is used to look up | 5469 | charset info in the font name is used to look up |
| 5511 | w32-charset-to-codepage-alist. */ | 5470 | w32-charset-to-codepage-alist. */ |
| @@ -5561,7 +5520,7 @@ w32_codepage_for_font (char *fontname) | |||
| 5561 | else | 5520 | else |
| 5562 | return CP_UNKNOWN; | 5521 | return CP_UNKNOWN; |
| 5563 | } | 5522 | } |
| 5564 | 5523 | #endif /* OLD_FONT */ | |
| 5565 | 5524 | ||
| 5566 | static BOOL | 5525 | static BOOL |
| 5567 | w32_to_x_font (lplogfont, lpxstr, len, specific_charset) | 5526 | w32_to_x_font (lplogfont, lpxstr, len, specific_charset) |
| @@ -5847,6 +5806,8 @@ x_to_w32_font (lpxstr, lplogfont) | |||
| 5847 | return (TRUE); | 5806 | return (TRUE); |
| 5848 | } | 5807 | } |
| 5849 | 5808 | ||
| 5809 | #if OLD_FONT | ||
| 5810 | |||
| 5850 | /* Strip the pixel height and point height from the given xlfd, and | 5811 | /* Strip the pixel height and point height from the given xlfd, and |
| 5851 | return the pixel height. If no pixel height is specified, calculate | 5812 | return the pixel height. If no pixel height is specified, calculate |
| 5852 | one from the point height, or if that isn't defined either, return | 5813 | one from the point height, or if that isn't defined either, return |
| @@ -6560,10 +6521,14 @@ w32_find_ccl_program (fontp) | |||
| 6560 | } | 6521 | } |
| 6561 | } | 6522 | } |
| 6562 | 6523 | ||
| 6524 | #endif /* OLD_FONT */ | ||
| 6525 | |||
| 6563 | /* directory-files from dired.c. */ | 6526 | /* directory-files from dired.c. */ |
| 6564 | Lisp_Object Fdirectory_files P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); | 6527 | Lisp_Object Fdirectory_files P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); |
| 6565 | 6528 | ||
| 6566 | 6529 | ||
| 6530 | #if OLD_FONT | ||
| 6531 | |||
| 6567 | /* Find BDF files in a specified directory. (use GCPRO when calling, | 6532 | /* Find BDF files in a specified directory. (use GCPRO when calling, |
| 6568 | as this calls lisp to get a directory listing). */ | 6533 | as this calls lisp to get a directory listing). */ |
| 6569 | static Lisp_Object | 6534 | static Lisp_Object |
| @@ -6614,6 +6579,7 @@ in the list. DIRECTORY may be a list of directories. */) | |||
| 6614 | } | 6579 | } |
| 6615 | return list; | 6580 | return list; |
| 6616 | } | 6581 | } |
| 6582 | #endif /* OLD_FONT */ | ||
| 6617 | 6583 | ||
| 6618 | 6584 | ||
| 6619 | DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, | 6585 | DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, |
| @@ -7084,6 +7050,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 7084 | error ("Display still has frames on it"); | 7050 | error ("Display still has frames on it"); |
| 7085 | 7051 | ||
| 7086 | BLOCK_INPUT; | 7052 | BLOCK_INPUT; |
| 7053 | #if OLD_FONT | ||
| 7087 | /* Free the fonts in the font table. */ | 7054 | /* Free the fonts in the font table. */ |
| 7088 | for (i = 0; i < dpyinfo->n_fonts; i++) | 7055 | for (i = 0; i < dpyinfo->n_fonts; i++) |
| 7089 | if (dpyinfo->font_table[i].name) | 7056 | if (dpyinfo->font_table[i].name) |
| @@ -7093,6 +7060,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 7093 | xfree (dpyinfo->font_table[i].name); | 7060 | xfree (dpyinfo->font_table[i].name); |
| 7094 | w32_unload_font (dpyinfo, dpyinfo->font_table[i].font); | 7061 | w32_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
| 7095 | } | 7062 | } |
| 7063 | #endif | ||
| 7096 | x_destroy_all_bitmaps (dpyinfo); | 7064 | x_destroy_all_bitmaps (dpyinfo); |
| 7097 | 7065 | ||
| 7098 | x_delete_display (dpyinfo); | 7066 | x_delete_display (dpyinfo); |
| @@ -7523,56 +7491,16 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 7523 | f->resx = dpyinfo->resx; | 7491 | f->resx = dpyinfo->resx; |
| 7524 | f->resy = dpyinfo->resy; | 7492 | f->resy = dpyinfo->resy; |
| 7525 | 7493 | ||
| 7526 | #ifdef USE_FONT_BACKEND | 7494 | /* Perhaps, we must allow frame parameter, say `font-backend', |
| 7527 | if (enable_font_backend) | 7495 | to specify which font backends to use. */ |
| 7528 | { | 7496 | register_font_driver (&w32font_driver, f); |
| 7529 | /* Perhaps, we must allow frame parameter, say `font-backend', | ||
| 7530 | to specify which font backends to use. */ | ||
| 7531 | register_font_driver (&w32font_driver, f); | ||
| 7532 | 7497 | ||
| 7533 | x_default_parameter (f, parms, Qfont_backend, Qnil, | 7498 | x_default_parameter (f, parms, Qfont_backend, Qnil, |
| 7534 | "fontBackend", "FontBackend", RES_TYPE_STRING); | 7499 | "fontBackend", "FontBackend", RES_TYPE_STRING); |
| 7535 | } | ||
| 7536 | #endif /* USE_FONT_BACKEND */ | ||
| 7537 | 7500 | ||
| 7538 | /* Extract the window parameters from the supplied values | 7501 | /* Extract the window parameters from the supplied values |
| 7539 | that are needed to determine window geometry. */ | 7502 | that are needed to determine window geometry. */ |
| 7540 | #ifdef USE_FONT_BACKEND | 7503 | x_default_font_parameter (f, parms); |
| 7541 | if (enable_font_backend) | ||
| 7542 | x_default_font_parameter (f, parms); | ||
| 7543 | else | ||
| 7544 | #endif /* USE_FONT_BACKEND */ | ||
| 7545 | { | ||
| 7546 | Lisp_Object font; | ||
| 7547 | |||
| 7548 | font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING); | ||
| 7549 | |||
| 7550 | BLOCK_INPUT; | ||
| 7551 | /* First, try whatever font the caller has specified. */ | ||
| 7552 | if (STRINGP (font)) | ||
| 7553 | { | ||
| 7554 | tem = Fquery_fontset (font, Qnil); | ||
| 7555 | if (STRINGP (tem)) | ||
| 7556 | font = x_new_fontset (f, tem); | ||
| 7557 | else | ||
| 7558 | font = x_new_font (f, SDATA (font)); | ||
| 7559 | } | ||
| 7560 | |||
| 7561 | /* Try out a font which we hope has bold and italic variations. */ | ||
| 7562 | if (!STRINGP (font)) | ||
| 7563 | font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); | ||
| 7564 | if (! STRINGP (font)) | ||
| 7565 | font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); | ||
| 7566 | /* If those didn't work, look for something which will at least work. */ | ||
| 7567 | if (! STRINGP (font)) | ||
| 7568 | font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); | ||
| 7569 | UNBLOCK_INPUT; | ||
| 7570 | if (! STRINGP (font)) | ||
| 7571 | font = build_string ("Fixedsys"); | ||
| 7572 | |||
| 7573 | x_default_parameter (f, parms, Qfont, font, | ||
| 7574 | "font", "Font", RES_TYPE_STRING); | ||
| 7575 | } | ||
| 7576 | 7504 | ||
| 7577 | x_default_parameter (f, parms, Qborder_width, make_number (2), | 7505 | x_default_parameter (f, parms, Qborder_width, make_number (2), |
| 7578 | "borderWidth", "BorderWidth", RES_TYPE_NUMBER); | 7506 | "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
| @@ -8304,7 +8232,7 @@ in the font selection dialog. */) | |||
| 8304 | /* Initialize as much of the font details as we can from the current | 8232 | /* Initialize as much of the font details as we can from the current |
| 8305 | default font. */ | 8233 | default font. */ |
| 8306 | hdc = GetDC (FRAME_W32_WINDOW (f)); | 8234 | hdc = GetDC (FRAME_W32_WINDOW (f)); |
| 8307 | oldobj = SelectObject (hdc, FRAME_FONT (f)->hfont); | 8235 | oldobj = SelectObject (hdc, FONT_COMPAT (FRAME_FONT (f))->hfont); |
| 8308 | GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); | 8236 | GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); |
| 8309 | if (GetTextMetrics (hdc, &tm)) | 8237 | if (GetTextMetrics (hdc, &tm)) |
| 8310 | { | 8238 | { |
| @@ -8996,9 +8924,7 @@ frame_parm_handler w32_frame_parm_handlers[] = | |||
| 8996 | x_set_fringe_width, | 8924 | x_set_fringe_width, |
| 8997 | 0, /* x_set_wait_for_wm, */ | 8925 | 0, /* x_set_wait_for_wm, */ |
| 8998 | x_set_fullscreen, | 8926 | x_set_fullscreen, |
| 8999 | #ifdef USE_FONT_BACKEND | ||
| 9000 | x_set_font_backend | 8927 | x_set_font_backend |
| 9001 | #endif | ||
| 9002 | }; | 8928 | }; |
| 9003 | 8929 | ||
| 9004 | void | 8930 | void |
| @@ -9395,12 +9321,15 @@ versions of Windows) characters. */); | |||
| 9395 | defsubr (&Sw32_reconstruct_hot_key); | 9321 | defsubr (&Sw32_reconstruct_hot_key); |
| 9396 | defsubr (&Sw32_toggle_lock_key); | 9322 | defsubr (&Sw32_toggle_lock_key); |
| 9397 | defsubr (&Sw32_window_exists_p); | 9323 | defsubr (&Sw32_window_exists_p); |
| 9324 | #if OLD_FONT | ||
| 9398 | defsubr (&Sw32_find_bdf_fonts); | 9325 | defsubr (&Sw32_find_bdf_fonts); |
| 9326 | #endif | ||
| 9399 | defsubr (&Sw32_battery_status); | 9327 | defsubr (&Sw32_battery_status); |
| 9400 | 9328 | ||
| 9401 | defsubr (&Sfile_system_info); | 9329 | defsubr (&Sfile_system_info); |
| 9402 | defsubr (&Sdefault_printer_name); | 9330 | defsubr (&Sdefault_printer_name); |
| 9403 | 9331 | ||
| 9332 | #if OLD_FONT | ||
| 9404 | /* Setting callback functions for fontset handler. */ | 9333 | /* Setting callback functions for fontset handler. */ |
| 9405 | get_font_info_func = w32_get_font_info; | 9334 | get_font_info_func = w32_get_font_info; |
| 9406 | 9335 | ||
| @@ -9414,6 +9343,7 @@ versions of Windows) characters. */); | |||
| 9414 | query_font_func = w32_query_font; | 9343 | query_font_func = w32_query_font; |
| 9415 | set_frame_fontset_func = x_set_font; | 9344 | set_frame_fontset_func = x_set_font; |
| 9416 | get_font_repertory_func = x_get_font_repertory; | 9345 | get_font_repertory_func = x_get_font_repertory; |
| 9346 | #endif | ||
| 9417 | check_window_system_func = check_w32; | 9347 | check_window_system_func = check_w32; |
| 9418 | 9348 | ||
| 9419 | 9349 | ||
| @@ -9476,9 +9406,7 @@ globals_of_w32fns () | |||
| 9476 | /* MessageBox does not work without this when linked to comctl32.dll 6.0. */ | 9406 | /* MessageBox does not work without this when linked to comctl32.dll 6.0. */ |
| 9477 | InitCommonControls (); | 9407 | InitCommonControls (); |
| 9478 | 9408 | ||
| 9479 | #ifdef USE_FONT_BACKEND | ||
| 9480 | syms_of_w32uniscribe (); | 9409 | syms_of_w32uniscribe (); |
| 9481 | #endif | ||
| 9482 | } | 9410 | } |
| 9483 | 9411 | ||
| 9484 | #undef abort | 9412 | #undef abort |