aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2008-02-17 02:03:44 +0000
committerKenichi Handa2008-02-17 02:03:44 +0000
commit9459b1e901014e9cdfff44553a3fda1775ea2296 (patch)
tree7951af0651f913ce08589d1df898131d4d13f9a1
parent3370d9f5b36378e235dce457db9bed23a3f4aeec (diff)
downloademacs-9459b1e901014e9cdfff44553a3fda1775ea2296.tar.gz
emacs-9459b1e901014e9cdfff44553a3fda1775ea2296.zip
(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.
-rw-r--r--src/fontset.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/fontset.c b/src/fontset.c
index 765fac0b9d8..bd4553bc481 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -303,6 +303,7 @@ fontset_id_valid_p (id)
303/* Macros to access special values of (realized) FONTSET. */ 303/* Macros to access special values of (realized) FONTSET. */
304#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 304#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
305#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 305#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
306#define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4]
306#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 307#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
307#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] 308#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6]
308#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 309#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
@@ -694,6 +695,8 @@ fontset_find_font (fontset, c, face, id, fallback)
694 FONT_ENTITY_SET_NOT_LOADABLE (font_entity); 695 FONT_ENTITY_SET_NOT_LOADABLE (font_entity);
695 continue; 696 continue;
696 } 697 }
698 FONTSET_OBJLIST (fontset)
699 = Fcons (font_object, FONTSET_OBJLIST (fontset));
697 ASET (elt, 3, font_object); 700 ASET (elt, 3, font_object);
698 if (has_char < 0) 701 if (has_char < 0)
699 { 702 {
@@ -912,6 +915,21 @@ fontset_ascii (id)
912 return elt; 915 return elt;
913} 916}
914 917
918void
919free_realized_fontset (f, fontset)
920 FRAME_PTR f;
921 Lisp_Object fontset;
922{
923 int i;
924 Lisp_Object tail;
925
926 return;
927 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
928 {
929 xassert (FONT_OBJECT_P (XCAR (tail)));
930 font_close_object (f, XCAR (tail));
931 }
932}
915 933
916/* Free fontset of FACE defined on frame F. Called from 934/* Free fontset of FACE defined on frame F. Called from
917 free_realized_face. */ 935 free_realized_face. */
@@ -926,6 +944,7 @@ free_face_fontset (f, face)
926 fontset = FONTSET_FROM_ID (face->fontset); 944 fontset = FONTSET_FROM_ID (face->fontset);
927 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); 945 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
928 xassert (f == XFRAME (FONTSET_FRAME (fontset))); 946 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
947 free_realized_fontset (f, fontset);
929 ASET (Vfontset_table, face->fontset, Qnil); 948 ASET (Vfontset_table, face->fontset, Qnil);
930 if (face->fontset < next_fontset_id) 949 if (face->fontset < next_fontset_id)
931 next_fontset_id = face->fontset; 950 next_fontset_id = face->fontset;
@@ -936,6 +955,7 @@ free_face_fontset (f, face)
936 fontset = AREF (Vfontset_table, id); 955 fontset = AREF (Vfontset_table, id);
937 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); 956 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
938 xassert (f == XFRAME (FONTSET_FRAME (fontset))); 957 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
958 free_realized_fontset (f, fontset);
939 ASET (Vfontset_table, id, Qnil); 959 ASET (Vfontset_table, id, Qnil);
940 if (id < next_fontset_id) 960 if (id < next_fontset_id)
941 next_fontset_id = face->fontset; 961 next_fontset_id = face->fontset;
@@ -1966,7 +1986,7 @@ If the named font is not yet loaded, return nil. */)
1966 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent); 1986 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
1967 1987
1968#ifdef USE_FONT_BACKEND 1988#ifdef USE_FONT_BACKEND
1969 if (! NILP (font_object)) 1989 if (enable_font_backend && ! NILP (font_object))
1970 font_close_object (f, font_object); 1990 font_close_object (f, font_object);
1971#endif /* USE_FONT_BACKEND */ 1991#endif /* USE_FONT_BACKEND */
1972 return info; 1992 return info;