aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1997-02-20 06:58:06 +0000
committerKarl Heuer1997-02-20 06:58:06 +0000
commit942ea06da56679aa06e237850252ea4589895454 (patch)
tree207dbd3741d44c26b6f90c3e8c23893ff5274788 /src
parenta851706636c64d487d6983fae54c4a74cb22c3af (diff)
downloademacs-942ea06da56679aa06e237850252ea4589895454.tar.gz
emacs-942ea06da56679aa06e237850252ea4589895454.zip
Include charset.h and fontset.h.
(Vx_pixel_size_width_font_regexp): New variable. (x_set_font): Handle fontset. (Fx_create_frame): Create fontsets in Vglobal_fontset_alist. (Fx_list_fonts): Handle fontset. (syms_of_xfns): Initialize Vx_pixel_size_width_font_regexp. Setting callback functions for fontset handler.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 5185e3287b7..519c606114b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -37,6 +37,8 @@ Boston, MA 02111-1307, USA. */
37#include "keyboard.h" 37#include "keyboard.h"
38#include "blockinput.h" 38#include "blockinput.h"
39#include <paths.h> 39#include <paths.h>
40#include "charset.h"
41#include "fontset.h"
40 42
41#ifdef HAVE_X_WINDOWS 43#ifdef HAVE_X_WINDOWS
42extern void abort (); 44extern void abort ();
@@ -131,6 +133,9 @@ Lisp_Object Vx_no_window_manager;
131/* Search path for bitmap files. */ 133/* Search path for bitmap files. */
132Lisp_Object Vx_bitmap_file_path; 134Lisp_Object Vx_bitmap_file_path;
133 135
136/* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
137Lisp_Object Vx_pixel_size_width_font_regexp;
138
134/* Evaluate this expression to rebuild the section of syms_of_xfns 139/* Evaluate this expression to rebuild the section of syms_of_xfns
135 that initializes and staticpros the symbols declared below. Note 140 that initializes and staticpros the symbols declared below. Note
136 that Emacs 18 has a bug that keeps C-x C-e from being able to 141 that Emacs 18 has a bug that keeps C-x C-e from being able to
@@ -1587,11 +1592,16 @@ x_set_font (f, arg, oldval)
1587 Lisp_Object arg, oldval; 1592 Lisp_Object arg, oldval;
1588{ 1593{
1589 Lisp_Object result; 1594 Lisp_Object result;
1595 Lisp_Object fontset_name;
1590 1596
1591 CHECK_STRING (arg, 1); 1597 CHECK_STRING (arg, 1);
1592 1598
1599 fontset_name = Fquery_fontset (arg);
1600
1593 BLOCK_INPUT; 1601 BLOCK_INPUT;
1594 result = x_new_font (f, XSTRING (arg)->data); 1602 result = (STRINGP (fontset_name)
1603 ? x_new_fontset (f, XSTRING (fontset_name)->data)
1604 : x_new_font (f, XSTRING (arg)->data));
1595 UNBLOCK_INPUT; 1605 UNBLOCK_INPUT;
1596 1606
1597 if (EQ (result, Qnil)) 1607 if (EQ (result, Qnil))
@@ -3175,16 +3185,28 @@ This function is an internal primitive--use `make-frame' instead.")
3175 specbind (Qx_resource_name, name); 3185 specbind (Qx_resource_name, name);
3176 } 3186 }
3177 3187
3188 /* Create fontsets from `global_fontset_alist' before handling fonts. */
3189 for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr)
3190 fs_register_fontset (f, XCONS (tem)->car);
3191
3178 /* Extract the window parameters from the supplied values 3192 /* Extract the window parameters from the supplied values
3179 that are needed to determine window geometry. */ 3193 that are needed to determine window geometry. */
3180 { 3194 {
3181 Lisp_Object font; 3195 Lisp_Object font;
3182 3196
3183 font = x_get_arg (parms, Qfont, "font", "Font", string); 3197 font = x_get_arg (parms, Qfont, "font", "Font", string);
3198 if (!STRINGP (font))
3199 font = x_get_arg (parms, Qfontset, "fontset", "Fontset", string);
3184 BLOCK_INPUT; 3200 BLOCK_INPUT;
3185 /* First, try whatever font the caller has specified. */ 3201 /* First, try whatever font the caller has specified. */
3186 if (STRINGP (font)) 3202 if (STRINGP (font))
3187 font = x_new_font (f, XSTRING (font)->data); 3203 {
3204 Lisp_Object fontset = Fquery_fontset (font);
3205 if (STRINGP (fontset))
3206 font = x_new_fontset (f, XSTRING (fontset)->data);
3207 else
3208 font = x_new_font (f, XSTRING (font)->data);
3209 }
3188 /* Try out a font which we hope has bold and italic variations. */ 3210 /* Try out a font which we hope has bold and italic variations. */
3189 if (!STRINGP (font)) 3211 if (!STRINGP (font))
3190 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); 3212 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
@@ -3363,6 +3385,9 @@ x_get_focus_frame (frame)
3363 return xfocus; 3385 return xfocus;
3364} 3386}
3365 3387
3388#if 1
3389#include "x-list-font.c"
3390#else
3366DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0, 3391DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0,
3367 "Return a list of the names of available fonts matching PATTERN.\n\ 3392 "Return a list of the names of available fonts matching PATTERN.\n\
3368If optional arguments FACE and FRAME are specified, return only fonts\n\ 3393If optional arguments FACE and FRAME are specified, return only fonts\n\
@@ -3571,6 +3596,7 @@ fonts to match. The first MAXIMUM fonts are reported.")
3571 3596
3572 return list; 3597 return list;
3573} 3598}
3599#endif
3574 3600
3575 3601
3576DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, 3602DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0,
@@ -4601,7 +4627,7 @@ DEFUN ("x-track-pointer", Fx_track_pointer, Sx_track_pointer, 1, 1, "e",
4601 if (tab_width <= 0 || tab_width > 20) tab_width = 8; 4627 if (tab_width <= 0 || tab_width > 20) tab_width = 8;
4602 do 4628 do
4603 { 4629 {
4604 c = FETCH_CHAR (p); 4630 c = FETCH_BYTE (p);
4605 if (len == f->width && hp == len - 1 && c != '\n') 4631 if (len == f->width && hp == len - 1 && c != '\n')
4606 goto draw_or_not; 4632 goto draw_or_not;
4607 4633
@@ -5217,6 +5243,16 @@ unless you set it to something else.");
5217 and maybe the user would like to set it to t. */ 5243 and maybe the user would like to set it to t. */
5218 Vx_no_window_manager = Qnil; 5244 Vx_no_window_manager = Qnil;
5219 5245
5246 DEFVAR_LISP ("x-pixel-size-width-font-regexp",
5247 &Vx_pixel_size_width_font_regexp,
5248 "Regexp matching a font name whose width is the same as `PIXEL_SIZE'.\n\
5249\n\
5250Since Emacs gets width of a font which this regexp maches from\n\
5251PIXEL_SIZE field of the name, font finding mechanism gets faster for\n\
5252such a font. This is especially effective for such large fonts as\n\
5253Chinese, Japanese, and Korean.");
5254 Vx_pixel_size_width_font_regexp = Qnil;
5255
5220#ifdef USE_X_TOOLKIT 5256#ifdef USE_X_TOOLKIT
5221 Fprovide (intern ("x-toolkit")); 5257 Fprovide (intern ("x-toolkit"));
5222#endif 5258#endif
@@ -5265,6 +5301,14 @@ unless you set it to something else.");
5265 defsubr (&Sx_close_connection); 5301 defsubr (&Sx_close_connection);
5266 defsubr (&Sx_display_list); 5302 defsubr (&Sx_display_list);
5267 defsubr (&Sx_synchronize); 5303 defsubr (&Sx_synchronize);
5304
5305 /* Setting callback functions for fontset handler. */
5306 get_font_info_func = x_get_font_info;
5307 list_fonts_func = x_list_fonts;
5308 load_font_func = x_load_font;
5309 query_font_func = x_query_font;
5310 set_frame_fontset_func = x_set_font;
5311 check_window_system_func = check_x;
5268} 5312}
5269 5313
5270#endif /* HAVE_X_WINDOWS */ 5314#endif /* HAVE_X_WINDOWS */