Commit a45543bc authored by Dmitry Antipov's avatar Dmitry Antipov

* 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.
parent ae966a86
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
......
......@@ -4226,36 +4226,38 @@ the consecutive wildcards are folded into one. */)
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;
}
......
......@@ -760,6 +760,7 @@ extern Lisp_Object font_load_for_lface (struct frame *f, Lisp_Object *lface,
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);
......
......@@ -759,11 +759,6 @@ clear_face_cache (int clear_fonts_p)
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. */
......@@ -774,7 +769,10 @@ clear_face_cache (int clear_fonts_p)
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment