diff options
| author | Kenichi Handa | 2006-06-06 03:56:46 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-06-06 03:56:46 +0000 |
| commit | 02ed2ea88a3d8fce9785c15ca54498954b241d81 (patch) | |
| tree | 401300b4487a0e0228d5371fd1e606bf63d6cf65 /src | |
| parent | c1c4887e39b7fcb430ddc4e9a997f788ec29e697 (diff) | |
| download | emacs-02ed2ea88a3d8fce9785c15ca54498954b241d81.tar.gz emacs-02ed2ea88a3d8fce9785c15ca54498954b241d81.zip | |
Include "font.h".
(x_default_font_parameter) [USE_FONT_BACKEND]: New function.
(Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is
nonzero, register all available font drivers. Call
x_default_font_parameter for deciding a font.
(x_create_tip_frame) [USE_FONT_BACKEND]: Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c index f52207f01c7..ed6d00d0325 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -49,6 +49,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 49 | #include "termhooks.h" | 49 | #include "termhooks.h" |
| 50 | #include "atimer.h" | 50 | #include "atimer.h" |
| 51 | 51 | ||
| 52 | #ifdef USE_FONT_BACKEND | ||
| 53 | #include "font.h" | ||
| 54 | #endif /* USE_FONT_BACKEND */ | ||
| 55 | |||
| 52 | #ifdef HAVE_X_WINDOWS | 56 | #ifdef HAVE_X_WINDOWS |
| 53 | 57 | ||
| 54 | #include <ctype.h> | 58 | #include <ctype.h> |
| @@ -537,6 +541,8 @@ x_top_window_to_frame (dpyinfo, wdesc) | |||
| 537 | 541 | ||
| 538 | 542 | ||
| 539 | 543 | ||
| 544 | static void x_default_font_parameter P_ ((struct frame *, Lisp_Object)); | ||
| 545 | |||
| 540 | static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); | 546 | static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
| 541 | static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); | 547 | static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
| 542 | 548 | ||
| @@ -2958,6 +2964,43 @@ unwind_create_frame (frame) | |||
| 2958 | return Qnil; | 2964 | return Qnil; |
| 2959 | } | 2965 | } |
| 2960 | 2966 | ||
| 2967 | #ifdef USE_FONT_BACKEND | ||
| 2968 | static void | ||
| 2969 | x_default_font_parameter (f, parms) | ||
| 2970 | struct frame *f; | ||
| 2971 | Lisp_Object parms; | ||
| 2972 | { | ||
| 2973 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 2974 | Lisp_Object font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", | ||
| 2975 | RES_TYPE_STRING); | ||
| 2976 | |||
| 2977 | if (! STRINGP (font)) | ||
| 2978 | { | ||
| 2979 | char *names[] | ||
| 2980 | = { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1", | ||
| 2981 | "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1", | ||
| 2982 | "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1", | ||
| 2983 | /* This was formerly the first thing tried, but it finds | ||
| 2984 | too many fonts and takes too long. */ | ||
| 2985 | "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1", | ||
| 2986 | /* If those didn't work, look for something which will | ||
| 2987 | at least work. */ | ||
| 2988 | "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1", | ||
| 2989 | NULL }; | ||
| 2990 | int i; | ||
| 2991 | |||
| 2992 | for (i = 0; names[i]; i++) | ||
| 2993 | { | ||
| 2994 | font = font_open_by_name (f, names[i]); | ||
| 2995 | if (! NILP (font)) | ||
| 2996 | break; | ||
| 2997 | } | ||
| 2998 | if (NILP (font)) | ||
| 2999 | font = build_string ("fixed"); | ||
| 3000 | } | ||
| 3001 | x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); | ||
| 3002 | } | ||
| 3003 | #endif /* USE_FONT_BACKEND */ | ||
| 2961 | 3004 | ||
| 2962 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | 3005 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
| 2963 | 1, 1, 0, | 3006 | 1, 1, 0, |
| @@ -3133,8 +3176,32 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3133 | specbind (Qx_resource_name, name); | 3176 | specbind (Qx_resource_name, name); |
| 3134 | } | 3177 | } |
| 3135 | 3178 | ||
| 3179 | f->resx = dpyinfo->resx; | ||
| 3180 | f->resy = dpyinfo->resy; | ||
| 3181 | |||
| 3182 | #ifdef USE_FONT_BACKEND | ||
| 3183 | if (enable_font_backend) | ||
| 3184 | { | ||
| 3185 | /* Perhaps, we must allow frame parameter, say `font-backend', | ||
| 3186 | to specify which font backends to use. */ | ||
| 3187 | #ifdef HAVE_FREETYPE | ||
| 3188 | #ifdef HAVE_XFT | ||
| 3189 | register_font_driver (&xftfont_driver, f); | ||
| 3190 | #else /* not HAVE_XFT */ | ||
| 3191 | register_font_driver (&ftxfont_driver, f); | ||
| 3192 | #endif /* not HAVE_XFT */ | ||
| 3193 | #endif /* HAVE_FREETYPE */ | ||
| 3194 | register_font_driver (&xfont_driver, f); | ||
| 3195 | } | ||
| 3196 | #endif /* USE_FONT_BACKEND */ | ||
| 3197 | |||
| 3136 | /* Extract the window parameters from the supplied values | 3198 | /* Extract the window parameters from the supplied values |
| 3137 | that are needed to determine window geometry. */ | 3199 | that are needed to determine window geometry. */ |
| 3200 | #ifdef USE_FONT_BACKEND | ||
| 3201 | if (enable_font_backend) | ||
| 3202 | x_default_font_parameter (f, parms); | ||
| 3203 | else | ||
| 3204 | #endif /* USE_FONT_BACKEND */ | ||
| 3138 | { | 3205 | { |
| 3139 | Lisp_Object font; | 3206 | Lisp_Object font; |
| 3140 | 3207 | ||
| @@ -4719,8 +4786,32 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 4719 | specbind (Qx_resource_name, name); | 4786 | specbind (Qx_resource_name, name); |
| 4720 | } | 4787 | } |
| 4721 | 4788 | ||
| 4789 | f->resx = dpyinfo->resx; | ||
| 4790 | f->resy = dpyinfo->resy; | ||
| 4791 | |||
| 4792 | #ifdef USE_FONT_BACKEND | ||
| 4793 | if (enable_font_backend) | ||
| 4794 | { | ||
| 4795 | /* Perhaps, we must allow frame parameter, say `font-backend', | ||
| 4796 | to specify which font backends to use. */ | ||
| 4797 | #ifdef HAVE_FREETYPE | ||
| 4798 | #ifdef HAVE_XFT | ||
| 4799 | register_font_driver (&xftfont_driver, f); | ||
| 4800 | #else /* not HAVE_XFT */ | ||
| 4801 | register_font_driver (&ftxfont_driver, f); | ||
| 4802 | #endif /* not HAVE_XFT */ | ||
| 4803 | #endif /* HAVE_FREETYPE */ | ||
| 4804 | register_font_driver (&xfont_driver, f); | ||
| 4805 | } | ||
| 4806 | #endif /* USE_FONT_BACKEND */ | ||
| 4807 | |||
| 4722 | /* Extract the window parameters from the supplied values that are | 4808 | /* Extract the window parameters from the supplied values that are |
| 4723 | needed to determine window geometry. */ | 4809 | needed to determine window geometry. */ |
| 4810 | #ifdef USE_FONT_BACKEND | ||
| 4811 | if (enable_font_backend) | ||
| 4812 | x_default_font_parameter (f, parms); | ||
| 4813 | else | ||
| 4814 | #endif /* USE_FONT_BACKEND */ | ||
| 4724 | { | 4815 | { |
| 4725 | Lisp_Object font; | 4816 | Lisp_Object font; |
| 4726 | 4817 | ||