+2013-08-13 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * font.c (clear_font_cache): New function, stripped from...
+ (Fclear_font_cache): ...here, which now uses the function
+ above. Adjust comment.
+ * font.h (clear_font_cache): Add prototype.
+ * xfaces.c (clear_face_cache): Use clear_font_cache.
+
2013-08-13 Dmitry Antipov <dmantipov@yandex.ru>
* window.c (Fset_window_start): Compare `w', not `window' because
return make_string (name, namelen);
}
+void
+clear_font_cache (struct frame *f)
+{
+ struct font_driver_list *driver_list = f->font_driver_list;
+
+ for (; driver_list; driver_list = driver_list->next)
+ if (driver_list->on)
+ {
+ Lisp_Object val, tmp, cache = driver_list->driver->get_cache (f);
+
+ val = XCDR (cache);
+ while (! NILP (val)
+ && ! EQ (XCAR (XCAR (val)), driver_list->driver->type))
+ val = XCDR (val);
+ eassert (! NILP (val));
+ tmp = XCDR (XCAR (val));
+ if (XINT (XCAR (tmp)) == 0)
+ {
+ font_clear_cache (f, XCAR (val), driver_list->driver);
+ XSETCDR (cache, XCDR (val));
+ }
+ }
+}
+
DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
- doc: /* Clear font cache. */)
+ doc: /* Clear font cache of each frame. */)
(void)
{
Lisp_Object list, frame;
FOR_EACH_FRAME (list, frame)
- {
- struct frame *f = XFRAME (frame);
- struct font_driver_list *driver_list = f->font_driver_list;
-
- for (; driver_list; driver_list = driver_list->next)
- if (driver_list->on)
- {
- Lisp_Object cache = driver_list->driver->get_cache (f);
- Lisp_Object val, tmp;
-
- val = XCDR (cache);
- while (! NILP (val)
- && ! EQ (XCAR (XCAR (val)), driver_list->driver->type))
- val = XCDR (val);
- eassert (! NILP (val));
- tmp = XCDR (XCAR (val));
- if (XINT (XCAR (tmp)) == 0)
- {
- font_clear_cache (f, XCAR (val), driver_list->driver);
- XSETCDR (cache, XCDR (val));
- }
- }
- }
+ clear_font_cache (XFRAME (frame));
return Qnil;
}
Lisp_Object spec);
extern void font_prepare_for_face (struct frame *f, struct face *face);
extern void font_done_for_face (struct frame *f, struct face *face);
+extern void clear_font_cache (struct frame *);
extern Lisp_Object font_open_by_spec (struct frame *f, Lisp_Object spec);
extern Lisp_Object font_open_by_name (struct frame *f, Lisp_Object name);
if (clear_fonts_p
|| ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)
{
-#if 0
- /* Not yet implemented. */
- clear_font_cache (frame);
-#endif
-
/* From time to time see if we can unload some fonts. This also
frees all realized faces on all frames. Fonts needed by
faces will be loaded again when faces are realized again. */
struct frame *f = XFRAME (frame);
if (FRAME_WINDOW_P (f)
&& FRAME_X_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS)
- free_all_realized_faces (frame);
+ {
+ clear_font_cache (f);
+ free_all_realized_faces (frame);
+ }
}
}
else