comparison src/font.c @ 103548:1a45bb782f72

(font_sort_entities, font_list_entities) (font_matching_entity, font_open_entity) (font_close_object): Change font_add_log to FONT_ADD_LOG. (Vfont_log): Delete static. (font_log_env_checked): Delete this variable. (font_add_log): Don't check font_log_env_checked. (font_deferred_log): Check Vfont_log. (init_font): New function.
author Kenichi Handa <handa@m17n.org>
date Tue, 23 Jun 2009 05:52:59 +0000
parents 97cfffb6f666
children 82ad563e96ed
comparison
equal deleted inserted replaced
103547:79b9f347f6d1 103548:1a45bb782f72
2370 } 2370 }
2371 else 2371 else
2372 vec = best_entity; 2372 vec = best_entity;
2373 SAFE_FREE (); 2373 SAFE_FREE ();
2374 2374
2375 font_add_log ("sort-by", prefer, vec); 2375 FONT_ADD_LOG ("sort-by", prefer, vec);
2376 return vec; 2376 return vec;
2377 } 2377 }
2378 2378
2379 2379
2380 /* API of Font Service Layer. */ 2380 /* API of Font Service Layer. */
2830 if (! NILP (val)) 2830 if (! NILP (val))
2831 vec[i++] = val; 2831 vec[i++] = val;
2832 } 2832 }
2833 2833
2834 val = (i > 0 ? Fvconcat (i, vec) : null_vector); 2834 val = (i > 0 ? Fvconcat (i, vec) : null_vector);
2835 font_add_log ("list", spec, val); 2835 FONT_ADD_LOG ("list", spec, val);
2836 return (val); 2836 return (val);
2837 } 2837 }
2838 2838
2839 2839
2840 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non 2840 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non
2881 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2881 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
2882 } 2882 }
2883 if (! NILP (entity)) 2883 if (! NILP (entity))
2884 break; 2884 break;
2885 } 2885 }
2886 font_add_log ("match", work, entity); 2886 FONT_ADD_LOG ("match", work, entity);
2887 return entity; 2887 return entity;
2888 } 2888 }
2889 2889
2890 2890
2891 /* Open a font of ENTITY and PIXEL_SIZE on frame F, and return the 2891 /* Open a font of ENTITY and PIXEL_SIZE on frame F, and return the
2923 if (! driver_list) 2923 if (! driver_list)
2924 return Qnil; 2924 return Qnil;
2925 2925
2926 font_object = driver_list->driver->open (f, entity, scaled_pixel_size); 2926 font_object = driver_list->driver->open (f, entity, scaled_pixel_size);
2927 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); 2927 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size));
2928 font_add_log ("open", entity, font_object); 2928 FONT_ADD_LOG ("open", entity, font_object);
2929 if (NILP (font_object)) 2929 if (NILP (font_object))
2930 return Qnil; 2930 return Qnil;
2931 ASET (entity, FONT_OBJLIST_INDEX, 2931 ASET (entity, FONT_OBJLIST_INDEX,
2932 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); 2932 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
2933 ASET (font_object, FONT_OBJLIST_INDEX, Qnil); 2933 ASET (font_object, FONT_OBJLIST_INDEX, Qnil);
2970 struct font *font = XFONT_OBJECT (font_object); 2970 struct font *font = XFONT_OBJECT (font_object);
2971 2971
2972 if (NILP (AREF (font_object, FONT_TYPE_INDEX))) 2972 if (NILP (AREF (font_object, FONT_TYPE_INDEX)))
2973 /* Already closed. */ 2973 /* Already closed. */
2974 return; 2974 return;
2975 font_add_log ("close", font_object, Qnil); 2975 FONT_ADD_LOG ("close", font_object, Qnil);
2976 font->driver->close (f, font); 2976 font->driver->close (f, font);
2977 #ifdef HAVE_WINDOW_SYSTEM 2977 #ifdef HAVE_WINDOW_SYSTEM
2978 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); 2978 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts);
2979 FRAME_X_DISPLAY_INFO (f)->n_fonts--; 2979 FRAME_X_DISPLAY_INFO (f)->n_fonts--;
2980 #endif 2980 #endif
5001 ASET (table, i, elt); 5001 ASET (table, i, elt);
5002 } 5002 }
5003 return table; 5003 return table;
5004 } 5004 }
5005 5005
5006 static Lisp_Object Vfont_log; 5006 Lisp_Object Vfont_log;
5007 static int font_log_env_checked;
5008 5007
5009 /* The deferred font-log data of the form [ACTION ARG RESULT]. 5008 /* The deferred font-log data of the form [ACTION ARG RESULT].
5010 If ACTION is not nil, that is added to the log when font_add_log is 5009 If ACTION is not nil, that is added to the log when font_add_log is
5011 called next time. At that time, ACTION is set back to nil. */ 5010 called next time. At that time, ACTION is set back to nil. */
5012 static Lisp_Object Vfont_log_deferred; 5011 static Lisp_Object Vfont_log_deferred;
5021 Lisp_Object arg, result; 5020 Lisp_Object arg, result;
5022 { 5021 {
5023 Lisp_Object tail, val; 5022 Lisp_Object tail, val;
5024 int i; 5023 int i;
5025 5024
5026 if (! font_log_env_checked)
5027 {
5028 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt;
5029 font_log_env_checked = 1;
5030 }
5031 if (EQ (Vfont_log, Qt)) 5025 if (EQ (Vfont_log, Qt))
5032 return; 5026 return;
5033 if (STRINGP (AREF (Vfont_log_deferred, 0))) 5027 if (STRINGP (AREF (Vfont_log_deferred, 0)))
5034 { 5028 {
5035 char *str = (char *) SDATA (AREF (Vfont_log_deferred, 0)); 5029 char *str = (char *) SDATA (AREF (Vfont_log_deferred, 0));
5105 void 5099 void
5106 font_deferred_log (action, arg, result) 5100 font_deferred_log (action, arg, result)
5107 char *action; 5101 char *action;
5108 Lisp_Object arg, result; 5102 Lisp_Object arg, result;
5109 { 5103 {
5104 if (EQ (Vfont_log, Qt))
5105 return;
5110 ASET (Vfont_log_deferred, 0, build_string (action)); 5106 ASET (Vfont_log_deferred, 0, build_string (action));
5111 ASET (Vfont_log_deferred, 1, arg); 5107 ASET (Vfont_log_deferred, 1, arg);
5112 ASET (Vfont_log_deferred, 2, result); 5108 ASET (Vfont_log_deferred, 2, result);
5113 } 5109 }
5114 5110
5296 syms_of_nsfont (); 5292 syms_of_nsfont ();
5297 #endif /* HAVE_NS */ 5293 #endif /* HAVE_NS */
5298 #endif /* HAVE_WINDOW_SYSTEM */ 5294 #endif /* HAVE_WINDOW_SYSTEM */
5299 } 5295 }
5300 5296
5297 void
5298 init_font ()
5299 {
5300 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt;
5301 }
5302
5301 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 5303 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846
5302 (do not change this comment) */ 5304 (do not change this comment) */