diff options
| author | Stefan Monnier | 2009-05-21 16:36:29 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-05-21 16:36:29 +0000 |
| commit | 46306a17286295bef205539603aa9cde7efc1258 (patch) | |
| tree | 01fa818cd9a1a0939d1d72180bcc3e80cabf89d8 /src | |
| parent | 01f17ae208c1bd9e70fa7fc76f5463aa46602815 (diff) | |
| download | emacs-46306a17286295bef205539603aa9cde7efc1258.tar.gz emacs-46306a17286295bef205539603aa9cde7efc1258.zip | |
(xfont_list_pattern): Don't initialize xfont_scripts_cache
and xfont_scratch_props.
(syms_of_xfont): Do it here instead.
(xfont_find_ccl_program): Delete, unused.
(xfont_open): Delete unused var `i'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/xfont.c | 71 |
2 files changed, 24 insertions, 65 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d4b1c2daadd..23f08d6409e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,13 +1,21 @@ | |||
| 1 | 2009-05-21 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * xfont.c (xfont_list_pattern): Don't initialize xfont_scripts_cache | ||
| 4 | and xfont_scratch_props. | ||
| 5 | (syms_of_xfont): Do it here instead. | ||
| 6 | (xfont_find_ccl_program): Delete, unused. | ||
| 7 | (xfont_open): Delete unused var `i'. | ||
| 8 | |||
| 1 | 2009-05-21 Kenichi Handa <handa@m17n.org> | 9 | 2009-05-21 Kenichi Handa <handa@m17n.org> |
| 2 | 10 | ||
| 3 | * fontset.c (Qlatin): Don't make it static. | 11 | * fontset.c (Qlatin): Don't make it static. |
| 4 | 12 | ||
| 5 | * xfont.c (xfont_chars_supported, xfont_supported_scripts): New | 13 | * xfont.c (xfont_chars_supported, xfont_supported_scripts): |
| 6 | functions. | 14 | New functions. |
| 7 | (xfont_scripts_cache, xfont_scratch_props): New variables. | 15 | (xfont_scripts_cache, xfont_scratch_props): New variables. |
| 8 | (Qlatin, Vscalable_fonts_allowed): Extern it. | 16 | (Qlatin, Vscalable_fonts_allowed): Extern it. |
| 9 | (xfont_list_pattern): Argument changed. Callers changed. Check | 17 | (xfont_list_pattern): Argument changed. Callers changed. |
| 10 | Vscalable_fonts_allowed. Check the support of a script. | 18 | Check Vscalable_fonts_allowed. Check the support of a script. |
| 11 | (xfont_list): Don't reject a font spec with :script property. | 19 | (xfont_list): Don't reject a font spec with :script property. |
| 12 | (xfont_has_char): Fix setting of encoding. | 20 | (xfont_has_char): Fix setting of encoding. |
| 13 | (syms_of_xfont): Staticpro and initialize xfont_scripts_cache and | 21 | (syms_of_xfont): Staticpro and initialize xfont_scripts_cache and |
| @@ -15,7 +23,7 @@ | |||
| 15 | 23 | ||
| 16 | 2009-05-19 Kenichi Handa <handa@m17n.org> | 24 | 2009-05-19 Kenichi Handa <handa@m17n.org> |
| 17 | 25 | ||
| 18 | * font.c (font_sort_entities): Renamed from font_sort_entites. | 26 | * font.c (font_sort_entities): Rename from font_sort_entites. |
| 19 | Callers changed. | 27 | Callers changed. |
| 20 | 28 | ||
| 21 | 2009-05-18 Kenichi Handa <handa@m17n.org> | 29 | 2009-05-18 Kenichi Handa <handa@m17n.org> |
diff --git a/src/xfont.c b/src/xfont.c index 87455bb504a..35113fdf798 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -49,7 +49,6 @@ struct xfont_info | |||
| 49 | extern void x_clear_errors P_ ((Display *)); | 49 | extern void x_clear_errors P_ ((Display *)); |
| 50 | 50 | ||
| 51 | static XCharStruct *xfont_get_pcm P_ ((XFontStruct *, XChar2b *)); | 51 | static XCharStruct *xfont_get_pcm P_ ((XFontStruct *, XChar2b *)); |
| 52 | static void xfont_find_ccl_program P_ ((struct font *)); | ||
| 53 | 52 | ||
| 54 | /* Get metrics of character CHAR2B in XFONT. Value is null if CHAR2B | 53 | /* Get metrics of character CHAR2B in XFONT. Value is null if CHAR2B |
| 55 | is not contained in the font. */ | 54 | is not contained in the font. */ |
| @@ -119,42 +118,6 @@ xfont_get_pcm (xfont, char2b) | |||
| 119 | ? NULL : pcm); | 118 | ? NULL : pcm); |
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | /* Find a CCL program for a font specified by FONTP, and set the member | ||
| 123 | `encoder' of the structure. */ | ||
| 124 | |||
| 125 | static void | ||
| 126 | xfont_find_ccl_program (font) | ||
| 127 | struct font *font; | ||
| 128 | { | ||
| 129 | Lisp_Object list, elt; | ||
| 130 | |||
| 131 | elt = Qnil; | ||
| 132 | for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCDR (list)) | ||
| 133 | { | ||
| 134 | elt = XCAR (list); | ||
| 135 | if (CONSP (elt) | ||
| 136 | && STRINGP (XCAR (elt)) | ||
| 137 | && ((fast_string_match_ignore_case (XCAR (elt), | ||
| 138 | font->props[FONT_NAME_INDEX]) | ||
| 139 | >= 0) | ||
| 140 | || (fast_string_match_ignore_case (XCAR (elt), | ||
| 141 | font->props[FONT_FULLNAME_INDEX]) | ||
| 142 | >= 0))) | ||
| 143 | break; | ||
| 144 | } | ||
| 145 | |||
| 146 | if (! NILP (list)) | ||
| 147 | { | ||
| 148 | struct ccl_program *ccl | ||
| 149 | = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); | ||
| 150 | |||
| 151 | if (setup_ccl_program (ccl, XCDR (elt)) < 0) | ||
| 152 | xfree (ccl); | ||
| 153 | else | ||
| 154 | font->font_encoder = ccl; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | static Lisp_Object xfont_get_cache P_ ((FRAME_PTR)); | 121 | static Lisp_Object xfont_get_cache P_ ((FRAME_PTR)); |
| 159 | static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); | 122 | static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); |
| 160 | static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); | 123 | static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); |
| @@ -408,14 +371,6 @@ xfont_list_pattern (Display *display, char *pattern, | |||
| 408 | script = Qnil; | 371 | script = Qnil; |
| 409 | } | 372 | } |
| 410 | } | 373 | } |
| 411 | if (! repertory && NILP (xfont_scripts_cache)) | ||
| 412 | { | ||
| 413 | Lisp_Object args[2]; | ||
| 414 | |||
| 415 | args[0] = QCtest; | ||
| 416 | args[1] = Qequal; | ||
| 417 | xfont_scripts_cache = Fmake_hash_table (2, args); | ||
| 418 | } | ||
| 419 | 374 | ||
| 420 | BLOCK_INPUT; | 375 | BLOCK_INPUT; |
| 421 | x_catch_errors (display); | 376 | x_catch_errors (display); |
| @@ -439,20 +394,11 @@ xfont_list_pattern (Display *display, char *pattern, | |||
| 439 | if (num_fonts > 0) | 394 | if (num_fonts > 0) |
| 440 | { | 395 | { |
| 441 | char **indices = alloca (sizeof (char *) * num_fonts); | 396 | char **indices = alloca (sizeof (char *) * num_fonts); |
| 442 | Lisp_Object *props; | 397 | Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents; |
| 443 | Lisp_Object scripts = Qnil; | 398 | Lisp_Object scripts = Qnil; |
| 444 | 399 | ||
| 445 | if (NILP (xfont_scratch_props)) | 400 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) |
| 446 | { | 401 | props[i] = Qnil; |
| 447 | xfont_scratch_props = Fmake_vector (make_number (8), Qnil); | ||
| 448 | props = XVECTOR (xfont_scratch_props)->contents; | ||
| 449 | } | ||
| 450 | else | ||
| 451 | { | ||
| 452 | props = XVECTOR (xfont_scratch_props)->contents; | ||
| 453 | for (i = 0; i < 8; i++) | ||
| 454 | props[i] = Qnil; | ||
| 455 | } | ||
| 456 | for (i = 0; i < num_fonts; i++) | 402 | for (i = 0; i < num_fonts; i++) |
| 457 | indices[i] = names[i]; | 403 | indices[i] = names[i]; |
| 458 | qsort (indices, num_fonts, sizeof (char *), compare_font_names); | 404 | qsort (indices, num_fonts, sizeof (char *), compare_font_names); |
| @@ -749,7 +695,6 @@ xfont_open (f, entity, pixel_size) | |||
| 749 | Lisp_Object font_object, fullname; | 695 | Lisp_Object font_object, fullname; |
| 750 | struct font *font; | 696 | struct font *font; |
| 751 | XFontStruct *xfont; | 697 | XFontStruct *xfont; |
| 752 | int i; | ||
| 753 | 698 | ||
| 754 | /* At first, check if we know how to encode characters for this | 699 | /* At first, check if we know how to encode characters for this |
| 755 | font. */ | 700 | font. */ |
| @@ -1176,9 +1121,15 @@ void | |||
| 1176 | syms_of_xfont () | 1121 | syms_of_xfont () |
| 1177 | { | 1122 | { |
| 1178 | staticpro (&xfont_scripts_cache); | 1123 | staticpro (&xfont_scripts_cache); |
| 1179 | xfont_scripts_cache = Qnil; | 1124 | { /* Here we rely on the fact that syms_of_xfont (via syms_of_font) |
| 1125 | is called fairly late, when QCtest and Qequal are known to be set. */ | ||
| 1126 | Lisp_Object args[2]; | ||
| 1127 | args[0] = QCtest; | ||
| 1128 | args[1] = Qequal; | ||
| 1129 | xfont_scripts_cache = Fmake_hash_table (2, args); | ||
| 1130 | } | ||
| 1180 | staticpro (&xfont_scratch_props); | 1131 | staticpro (&xfont_scratch_props); |
| 1181 | xfont_scratch_props = Qnil;; | 1132 | xfont_scratch_props = Fmake_vector (make_number (8), Qnil); |
| 1182 | xfont_driver.type = Qx; | 1133 | xfont_driver.type = Qx; |
| 1183 | register_font_driver (&xfont_driver, NULL); | 1134 | register_font_driver (&xfont_driver, NULL); |
| 1184 | } | 1135 | } |