aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-05-14 01:42:09 +0000
committerKenichi Handa2008-05-14 01:42:09 +0000
commitb51238f5ce0a25760f1779655e587f1f284caaa4 (patch)
treeaa664b97f08e47aed8569a6abd0d4419d9b1cc25 /src
parent2dee4c0b8dd17f9864d95c868ac362aa04572522 (diff)
downloademacs-b51238f5ce0a25760f1779655e587f1f284caaa4.tar.gz
emacs-b51238f5ce0a25760f1779655e587f1f284caaa4.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. (xic_create_xfontset): Original code deleted and renamed from xic_create_xfontset2. Use FRAME_FONT, not FRAME_FONT_OBJECT. (x_make_gc): Don't set GCFont in GCs. (Fx_create_frame) [USE_LUCID]: Set xlwmenu_default_font to a font opened by "fixed". (syms_of_xfns): Don't set get_font_info_func, load_font_func, find_ccl_program_func, query_font_func, set_frame_fontset_func, get_font_repertory_func.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c282
1 files changed, 25 insertions, 257 deletions
diff --git a/src/xfns.c b/src/xfns.c
index bfbc6ac02e9..1d8d004cd63 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -50,10 +50,7 @@ Boston, MA 02110-1301, USA. */
50#include "termhooks.h" 50#include "termhooks.h"
51#include "atimer.h" 51#include "atimer.h"
52#include "termchar.h" 52#include "termchar.h"
53
54#ifdef USE_FONT_BACKEND
55#include "font.h" 53#include "font.h"
56#endif /* USE_FONT_BACKEND */
57 54
58#ifdef HAVE_X_WINDOWS 55#ifdef HAVE_X_WINDOWS
59 56
@@ -1928,8 +1925,7 @@ hack_wm_protocols (f, widget)
1928 1925
1929#ifdef HAVE_X_I18N 1926#ifdef HAVE_X_I18N
1930 1927
1931static XFontSet xic_create_xfontset P_ ((struct frame *, char *)); 1928static XFontSet xic_create_xfontset P_ ((struct frame *));
1932static XFontSet xic_create_xfontset2 P_ ((struct frame *));
1933static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *)); 1929static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *));
1934 1930
1935 1931
@@ -2105,105 +2101,11 @@ print_fontset_result (xfs, name, missing_list, missing_count)
2105#endif 2101#endif
2106 2102
2107static XFontSet 2103static XFontSet
2108xic_create_xfontset (f, base_fontname) 2104xic_create_xfontset (f)
2109 struct frame *f; 2105 struct frame *f;
2110 char *base_fontname;
2111{ 2106{
2112 XFontSet xfs = NULL; 2107 XFontSet xfs = NULL;
2113 char **missing_list = NULL; 2108 struct font *font = FRAME_FONT (f);
2114 int missing_count;
2115 char *def_string;
2116 Lisp_Object rest, frame;
2117
2118 if (!base_fontname)
2119 base_fontname = xic_defaut_fontset;
2120
2121 /* See if there is another frame already using same fontset. */
2122 FOR_EACH_FRAME (rest, frame)
2123 {
2124 struct frame *cf = XFRAME (frame);
2125 if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
2126 && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
2127 && FRAME_XIC_BASE_FONTNAME (cf)
2128 && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname))
2129 {
2130 xfs = FRAME_XIC_FONTSET (cf);
2131 break;
2132 }
2133 }
2134
2135 if (!xfs)
2136 {
2137 char *fontsetname = xic_create_fontsetname (base_fontname, False);
2138
2139 /* New fontset. */
2140 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
2141 fontsetname, &missing_list,
2142 &missing_count, &def_string);
2143#ifdef DEBUG_XIC_FONTSET
2144 print_fontset_result (xfs, fontsetname, missing_list, missing_count);
2145#endif
2146 if (missing_list)
2147 XFreeStringList (missing_list);
2148 if (! xfs)
2149 {
2150 /* FONTSETNAME contains a list of font names (specific fonts
2151 first, general fonts last), but giving that to
2152 XCreateFontSet at once occasionally fails (bug of X?).
2153 So, we try to call XCreateFontSet for each fontname. */
2154 char *p0 = fontsetname, *p1;
2155
2156 while (p0)
2157 {
2158 p1 = strchr (p0, ',');
2159 if (p1)
2160 *p1 = '\0';
2161 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
2162 p0, &missing_list,
2163 &missing_count, &def_string);
2164#ifdef DEBUG_XIC_FONTSET
2165 print_fontset_result (xfs, p0, missing_list, missing_count);
2166#endif
2167 if (missing_list)
2168 XFreeStringList (missing_list);
2169 if (xfs)
2170 break;
2171 p0 = p1 ? p1 + 1 : NULL;
2172 }
2173 }
2174 xfree (fontsetname);
2175 if (! xfs && base_fontname != xic_defaut_fontset)
2176 {
2177 /* Try the default fontset name at a last resort. */
2178 fontsetname = xic_create_fontsetname (xic_defaut_fontset, False);
2179 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
2180 fontsetname, &missing_list,
2181 &missing_count, &def_string);
2182#ifdef DEBUG_XIC_FONTSET
2183 print_fontset_result (xfs, fontsetname, missing_list, missing_count);
2184#endif
2185 if (missing_list)
2186 XFreeStringList (missing_list);
2187 xfree (fontsetname);
2188 }
2189 }
2190
2191 if (FRAME_XIC_BASE_FONTNAME (f))
2192 xfree (FRAME_XIC_BASE_FONTNAME (f));
2193 FRAME_XIC_BASE_FONTNAME (f) = xstrdup (base_fontname);
2194
2195 /* No need to free def_string. */
2196 return xfs;
2197}
2198
2199#ifdef USE_FONT_BACKEND
2200
2201static XFontSet
2202xic_create_xfontset2 (f)
2203 struct frame *f;
2204{
2205 XFontSet xfs = NULL;
2206 struct font *font = FRAME_FONT_OBJECT (f);
2207 int pixel_size = font->pixel_size; 2109 int pixel_size = font->pixel_size;
2208 Lisp_Object rest, frame; 2110 Lisp_Object rest, frame;
2209 2111
@@ -2214,8 +2116,8 @@ xic_create_xfontset2 (f)
2214 2116
2215 if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf) 2117 if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
2216 && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f) 2118 && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
2217 && FRAME_FONT_OBJECT (f) 2119 && FRAME_FONT (f)
2218 && FRAME_FONT_OBJECT (f)->pixel_size == pixel_size) 2120 && FRAME_FONT (f)->pixel_size == pixel_size)
2219 { 2121 {
2220 xfs = FRAME_XIC_FONTSET (cf); 2122 xfs = FRAME_XIC_FONTSET (cf);
2221 break; 2123 break;
@@ -2295,7 +2197,6 @@ xic_create_xfontset2 (f)
2295 2197
2296 return xfs; 2198 return xfs;
2297} 2199}
2298#endif /* USE_FONT_BACKEND */
2299 2200
2300/* Free the X fontset of frame F if it is the last frame using it. */ 2201/* Free the X fontset of frame F if it is the last frame using it. */
2301 2202
@@ -2369,15 +2270,7 @@ create_frame_xic (f)
2369 return; 2270 return;
2370 2271
2371 /* Create X fontset. */ 2272 /* Create X fontset. */
2372#ifdef USE_FONT_BACKEND 2273 xfs = xic_create_xfontset (f);
2373 if (enable_font_backend)
2374 xfs = xic_create_xfontset2 (f);
2375 else
2376#endif
2377 xfs = xic_create_xfontset
2378 (f, (FRAME_FONTSET (f) < 0) ? NULL
2379 : (char *) SDATA (fontset_ascii (FRAME_FONTSET (f))));
2380
2381 xim = FRAME_X_XIM (f); 2274 xim = FRAME_X_XIM (f);
2382 if (xim) 2275 if (xim)
2383 { 2276 {
@@ -2532,12 +2425,7 @@ xic_set_xfontset (f, base_fontname)
2532 2425
2533 xic_free_xfontset (f); 2426 xic_free_xfontset (f);
2534 2427
2535#ifdef USE_FONT_BACKEND 2428 xfs = xic_create_xfontset (f);
2536 if (enable_font_backend)
2537 xfs = xic_create_xfontset2 (f);
2538 else
2539#endif
2540 xfs = xic_create_xfontset (f, base_fontname);
2541 2429
2542 attr = XVaCreateNestedList (0, XNFontSet, xfs, NULL); 2430 attr = XVaCreateNestedList (0, XNFontSet, xfs, NULL);
2543 if (FRAME_XIC_STYLE (f) & XIMPreeditPosition) 2431 if (FRAME_XIC_STYLE (f) & XIMPreeditPosition)
@@ -3041,20 +2929,13 @@ x_make_gc (f)
3041 /* Create the GCs of this frame. 2929 /* Create the GCs of this frame.
3042 Note that many default values are used. */ 2930 Note that many default values are used. */
3043 2931
3044 /* Normal video */
3045#ifdef USE_FONT_BACKEND
3046 if (enable_font_backend)
3047 gc_values.font = FRAME_X_DISPLAY_INFO (f)->font->fid;
3048 else
3049#endif
3050 gc_values.font = FRAME_FONT (f)->fid;
3051 gc_values.foreground = FRAME_FOREGROUND_PIXEL (f); 2932 gc_values.foreground = FRAME_FOREGROUND_PIXEL (f);
3052 gc_values.background = FRAME_BACKGROUND_PIXEL (f); 2933 gc_values.background = FRAME_BACKGROUND_PIXEL (f);
3053 gc_values.line_width = 0; /* Means 1 using fast algorithm. */ 2934 gc_values.line_width = 0; /* Means 1 using fast algorithm. */
3054 f->output_data.x->normal_gc 2935 f->output_data.x->normal_gc
3055 = XCreateGC (FRAME_X_DISPLAY (f), 2936 = XCreateGC (FRAME_X_DISPLAY (f),
3056 FRAME_X_WINDOW (f), 2937 FRAME_X_WINDOW (f),
3057 GCLineWidth | GCFont | GCForeground | GCBackground, 2938 GCLineWidth | GCForeground | GCBackground,
3058 &gc_values); 2939 &gc_values);
3059 2940
3060 /* Reverse video style. */ 2941 /* Reverse video style. */
@@ -3063,7 +2944,7 @@ x_make_gc (f)
3063 f->output_data.x->reverse_gc 2944 f->output_data.x->reverse_gc
3064 = XCreateGC (FRAME_X_DISPLAY (f), 2945 = XCreateGC (FRAME_X_DISPLAY (f),
3065 FRAME_X_WINDOW (f), 2946 FRAME_X_WINDOW (f),
3066 GCFont | GCForeground | GCBackground | GCLineWidth, 2947 GCForeground | GCBackground | GCLineWidth,
3067 &gc_values); 2948 &gc_values);
3068 2949
3069 /* Cursor has cursor-color background, background-color foreground. */ 2950 /* Cursor has cursor-color background, background-color foreground. */
@@ -3076,7 +2957,7 @@ x_make_gc (f)
3076 cursor_bits, 16, 16); 2957 cursor_bits, 16, 16);
3077 f->output_data.x->cursor_gc 2958 f->output_data.x->cursor_gc
3078 = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 2959 = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3079 (GCFont | GCForeground | GCBackground 2960 (GCForeground | GCBackground
3080 | GCFillStyle /* | GCStipple */ | GCLineWidth), 2961 | GCFillStyle /* | GCStipple */ | GCLineWidth),
3081 &gc_values); 2962 &gc_values);
3082 2963
@@ -3173,7 +3054,7 @@ unwind_create_frame (frame)
3173 return Qnil; 3054 return Qnil;
3174} 3055}
3175 3056
3176#ifdef USE_FONT_BACKEND 3057
3177static void 3058static void
3178x_default_font_parameter (f, parms) 3059x_default_font_parameter (f, parms)
3179 struct frame *f; 3060 struct frame *f;
@@ -3210,7 +3091,7 @@ x_default_font_parameter (f, parms)
3210 } 3091 }
3211 x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); 3092 x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING);
3212} 3093}
3213#endif /* USE_FONT_BACKEND */ 3094
3214 3095
3215DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 3096DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
3216 1, 1, 0, 3097 1, 1, 0,
@@ -3394,78 +3275,26 @@ This function is an internal primitive--use `make-frame' instead. */)
3394 f->resx = dpyinfo->resx; 3275 f->resx = dpyinfo->resx;
3395 f->resy = dpyinfo->resy; 3276 f->resy = dpyinfo->resy;
3396 3277
3397#ifdef USE_FONT_BACKEND
3398 if (enable_font_backend)
3399 {
3400 /* Perhaps, we must allow frame parameter, say `font-backend',
3401 to specify which font backends to use. */
3402#ifdef HAVE_FREETYPE 3278#ifdef HAVE_FREETYPE
3403#ifdef HAVE_XFT 3279#ifdef HAVE_XFT
3404 register_font_driver (&xftfont_driver, f); 3280 register_font_driver (&xftfont_driver, f);
3405#else /* not HAVE_XFT */ 3281#else /* not HAVE_XFT */
3406 register_font_driver (&ftxfont_driver, f); 3282 register_font_driver (&ftxfont_driver, f);
3407#endif /* not HAVE_XFT */ 3283#endif /* not HAVE_XFT */
3408#endif /* HAVE_FREETYPE */ 3284#endif /* HAVE_FREETYPE */
3409 register_font_driver (&xfont_driver, f); 3285 register_font_driver (&xfont_driver, f);
3410 3286
3411 x_default_parameter (f, parms, Qfont_backend, Qnil, 3287 x_default_parameter (f, parms, Qfont_backend, Qnil,
3412 "fontBackend", "FontBackend", RES_TYPE_STRING); 3288 "fontBackend", "FontBackend", RES_TYPE_STRING);
3413 }
3414#endif /* USE_FONT_BACKEND */
3415 3289
3416 /* Extract the window parameters from the supplied values 3290 /* Extract the window parameters from the supplied values
3417 that are needed to determine window geometry. */ 3291 that are needed to determine window geometry. */
3418#ifdef USE_FONT_BACKEND 3292 x_default_font_parameter (f, parms);
3419 if (enable_font_backend)
3420 x_default_font_parameter (f, parms);
3421else
3422#endif /* USE_FONT_BACKEND */
3423 {
3424 Lisp_Object font;
3425
3426 font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
3427
3428 /* If the caller has specified no font, try out fonts which we
3429 hope have bold and italic variations. */
3430 if (!STRINGP (font))
3431 {
3432 char *names[]
3433 = { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
3434 "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
3435 "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
3436 /* This was formerly the first thing tried, but it finds
3437 too many fonts and takes too long. */
3438 "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
3439 /* If those didn't work, look for something which will
3440 at least work. */
3441 "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
3442 NULL };
3443 int i;
3444
3445 BLOCK_INPUT;
3446 for (i = 0; names[i]; i++)
3447 {
3448 Lisp_Object list;
3449
3450 list = x_list_fonts (f, build_string (names[i]), 0, 1);
3451 if (CONSP (list))
3452 {
3453 font = XCAR (list);
3454 break;
3455 }
3456 }
3457 UNBLOCK_INPUT;
3458 if (! STRINGP (font))
3459 font = build_string ("fixed");
3460 }
3461 x_default_parameter (f, parms, Qfont, font,
3462 "font", "Font", RES_TYPE_STRING);
3463 }
3464 3293
3465#ifdef USE_LUCID 3294#ifdef USE_LUCID
3466 /* Prevent lwlib/xlwmenu.c from crashing because of a bug 3295 /* Prevent lwlib/xlwmenu.c from crashing because of a bug
3467 whereby it fails to get any font. */ 3296 whereby it fails to get any font. */
3468 xlwmenu_default_font = FRAME_FONT (f); 3297 xlwmenu_default_font = XLoadQueryFont (FRAME_X_DISPLAY (f), "fixed");
3469#endif 3298#endif
3470 3299
3471 /* Frame contents get displaced if an embedded X window has a border. */ 3300 /* Frame contents get displaced if an embedded X window has a border. */
@@ -4987,68 +4816,21 @@ x_create_tip_frame (dpyinfo, parms, text)
4987 f->resx = dpyinfo->resx; 4816 f->resx = dpyinfo->resx;
4988 f->resy = dpyinfo->resy; 4817 f->resy = dpyinfo->resy;
4989 4818
4990#ifdef USE_FONT_BACKEND
4991 if (enable_font_backend)
4992 {
4993 /* Perhaps, we must allow frame parameter, say `font-backend',
4994 to specify which font backends to use. */
4995#ifdef HAVE_FREETYPE 4819#ifdef HAVE_FREETYPE
4996#ifdef HAVE_XFT 4820#ifdef HAVE_XFT
4997 register_font_driver (&xftfont_driver, f); 4821 register_font_driver (&xftfont_driver, f);
4998#else /* not HAVE_XFT */ 4822#else /* not HAVE_XFT */
4999 register_font_driver (&ftxfont_driver, f); 4823 register_font_driver (&ftxfont_driver, f);
5000#endif /* not HAVE_XFT */ 4824#endif /* not HAVE_XFT */
5001#endif /* HAVE_FREETYPE */ 4825#endif /* HAVE_FREETYPE */
5002 register_font_driver (&xfont_driver, f); 4826 register_font_driver (&xfont_driver, f);
5003 4827
5004 x_default_parameter (f, parms, Qfont_backend, Qnil, 4828 x_default_parameter (f, parms, Qfont_backend, Qnil,
5005 "fontBackend", "FontBackend", RES_TYPE_STRING); 4829 "fontBackend", "FontBackend", RES_TYPE_STRING);
5006 }
5007#endif /* USE_FONT_BACKEND */
5008 4830
5009 /* Extract the window parameters from the supplied values that are 4831 /* Extract the window parameters from the supplied values that are
5010 needed to determine window geometry. */ 4832 needed to determine window geometry. */
5011#ifdef USE_FONT_BACKEND 4833 x_default_font_parameter (f, parms);
5012 if (enable_font_backend)
5013 x_default_font_parameter (f, parms);
5014else
5015#endif /* USE_FONT_BACKEND */
5016 {
5017 Lisp_Object font;
5018
5019 font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
5020
5021 BLOCK_INPUT;
5022 /* First, try whatever font the caller has specified. */
5023 if (STRINGP (font))
5024 {
5025 tem = Fquery_fontset (font, Qnil);
5026 if (STRINGP (tem))
5027 font = x_new_fontset (f, tem);
5028 else
5029 font = x_new_font (f, SDATA (font));
5030 }
5031
5032 /* Try out a font which we hope has bold and italic variations. */
5033 if (!STRINGP (font))
5034 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
5035 if (!STRINGP (font))
5036 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
5037 if (! STRINGP (font))
5038 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
5039 if (! STRINGP (font))
5040 /* This was formerly the first thing tried, but it finds too many fonts
5041 and takes too long. */
5042 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
5043 /* If those didn't work, look for something which will at least work. */
5044 if (! STRINGP (font))
5045 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
5046 UNBLOCK_INPUT;
5047 if (! STRINGP (font))
5048 font = build_string ("fixed");
5049
5050 x_set_frame_parameters (f, Fcons (Fcons (Qfont, font), Qnil));
5051 }
5052 4834
5053 x_default_parameter (f, parms, Qborder_width, make_number (2), 4835 x_default_parameter (f, parms, Qborder_width, make_number (2),
5054 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 4836 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
@@ -5991,9 +5773,7 @@ frame_parm_handler x_frame_parm_handlers[] =
5991 x_set_fringe_width, 5773 x_set_fringe_width,
5992 x_set_wait_for_wm, 5774 x_set_wait_for_wm,
5993 x_set_fullscreen, 5775 x_set_fullscreen,
5994#ifdef USE_FONT_BACKEND
5995 x_set_font_backend 5776 x_set_font_backend
5996#endif /* USE_FONT_BACKEND */
5997}; 5777};
5998 5778
5999void 5779void
@@ -6193,18 +5973,6 @@ the tool bar buttons. */);
6193 defsubr (&Sx_backspace_delete_keys_p); 5973 defsubr (&Sx_backspace_delete_keys_p);
6194 5974
6195 /* Setting callback functions for fontset handler. */ 5975 /* Setting callback functions for fontset handler. */
6196 get_font_info_func = x_get_font_info;
6197
6198#if 0 /* This function pointer doesn't seem to be used anywhere.
6199 And the pointer assigned has the wrong type, anyway. */
6200 list_fonts_func = x_list_fonts;
6201#endif
6202
6203 load_font_func = x_load_font;
6204 find_ccl_program_func = x_find_ccl_program;
6205 query_font_func = x_query_font;
6206 set_frame_fontset_func = x_set_font;
6207 get_font_repertory_func = x_get_font_repertory;
6208 check_window_system_func = check_x; 5976 check_window_system_func = check_x;
6209 5977
6210 hourglass_atimer = NULL; 5978 hourglass_atimer = NULL;