changeset 91908:6916adc8df33

(FONTSET_OBJLIST): New macro. (fontset_find_font): Update font-object list of the fontset. (free_realized_fontset): New function. (free_face_fontset): Call free_realized_fontset. (Ffont_info): Call font_close_object only when enable_font_backend is set.
author Kenichi Handa <handa@m17n.org>
date Sun, 17 Feb 2008 02:03:44 +0000
parents 21cc6c5f4996
children a549624ad4bc
files src/fontset.c
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Sun Feb 17 02:03:32 2008 +0000
+++ b/src/fontset.c	Sun Feb 17 02:03:44 2008 +0000
@@ -303,6 +303,7 @@
 /* Macros to access special values of (realized) FONTSET.  */
 #define FONTSET_BASE(fontset)		XCHAR_TABLE (fontset)->extras[2]
 #define FONTSET_FRAME(fontset)		XCHAR_TABLE (fontset)->extras[3]
+#define FONTSET_OBJLIST(fontset)	XCHAR_TABLE (fontset)->extras[4]
 #define FONTSET_NOFONT_FACE(fontset)	XCHAR_TABLE (fontset)->extras[5]
 #define FONTSET_REPERTORY(fontset)	XCHAR_TABLE (fontset)->extras[6]
 #define FONTSET_DEFAULT(fontset)	XCHAR_TABLE (fontset)->extras[7]
@@ -694,6 +695,8 @@
 		  FONT_ENTITY_SET_NOT_LOADABLE (font_entity);
 		  continue;
 		}
+	      FONTSET_OBJLIST (fontset)
+		= Fcons (font_object, FONTSET_OBJLIST (fontset));
 	      ASET (elt, 3, font_object);
 	      if (has_char < 0)
 		{
@@ -912,6 +915,21 @@
   return elt;
 }
 
+void
+free_realized_fontset (f, fontset)
+     FRAME_PTR f;
+     Lisp_Object fontset;
+{
+  int i;
+  Lisp_Object tail;
+
+  return;
+  for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
+    {
+      xassert (FONT_OBJECT_P (XCAR (tail)));
+      font_close_object (f, XCAR (tail));
+    }
+}
 
 /* Free fontset of FACE defined on frame F.  Called from
    free_realized_face.  */
@@ -926,6 +944,7 @@
   fontset = FONTSET_FROM_ID (face->fontset);
   xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
   xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+  free_realized_fontset (f, fontset);
   ASET (Vfontset_table, face->fontset, Qnil);
   if (face->fontset < next_fontset_id)
     next_fontset_id = face->fontset;
@@ -936,6 +955,7 @@
       fontset = AREF (Vfontset_table, id);
       xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
       xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+      free_realized_fontset (f, fontset);
       ASET (Vfontset_table, id, Qnil);
       if (id < next_fontset_id)
 	next_fontset_id = face->fontset;
@@ -1966,7 +1986,7 @@
   XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
 
 #ifdef USE_FONT_BACKEND
-  if (! NILP (font_object))
+  if (enable_font_backend && ! NILP (font_object))
     font_close_object (f, font_object);
 #endif	/* USE_FONT_BACKEND */
   return info;