1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-14 11:42:29 -08:00

* 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.
This commit is contained in:
Dmitry Antipov 2013-08-13 12:18:11 +04:00
parent ae966a860a
commit a45543bc75
4 changed files with 39 additions and 30 deletions

View file

@ -1,3 +1,11 @@
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

View file

@ -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;
}

View file

@ -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);

View file

@ -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