Mercurial > emacs
changeset 96000:f2d08191aec7
(font_check_object): Delete it.
(font_clear_cache): Check if a font-object is alive.
(font_open_entity): Likewise. Set FONT_OBJLST_INDEX of a
font-object to nil.
(font_close_object): Don't check FONT_CLOSE_OBJECT.
(font_at): Don't call font_check_object.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 16 Jun 2008 07:32:04 +0000 |
parents | c5659b8c29d6 |
children | b41affc105cf |
files | src/font.c |
diffstat | 1 files changed, 18 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/src/font.c Mon Jun 16 04:55:44 2008 +0000 +++ b/src/font.c Mon Jun 16 07:32:04 2008 +0000 @@ -2427,26 +2427,6 @@ return (font_score (entity, prefer_prop) == 0); } - - -/* CHeck a lispy font object corresponding to FONT. */ - -int -font_check_object (font) - struct font *font; -{ - Lisp_Object tail, elt; - - for (tail = font->props[FONT_OBJLIST_INDEX]; CONSP (tail); - tail = XCDR (tail)) - { - elt = XCAR (tail); - if (font == XFONT_OBJECT (elt)) - return 1; - } - return 0; -} - /* Font cache @@ -2563,9 +2543,12 @@ Lisp_Object val = XCAR (objlist); struct font *font = XFONT_OBJECT (val); - font_assert (font && driver == font->driver); - driver->close (f, font); - num_fonts--; + if (! NILP (AREF (val, FONT_TYPE_INDEX))) + { + font_assert (font && driver == font->driver); + driver->close (f, font); + num_fonts--; + } } if (driver->free_entity) driver->free_entity (entity); @@ -2754,7 +2737,8 @@ for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist); objlist = XCDR (objlist)) - if (XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size) + if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX)) + && XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size) return XCAR (objlist); val = AREF (entity, FONT_TYPE_INDEX); @@ -2770,7 +2754,7 @@ return Qnil; ASET (entity, FONT_OBJLIST_INDEX, Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); - ASET (font_object, FONT_OBJLIST_INDEX, AREF (entity, FONT_OBJLIST_INDEX)); + ASET (font_object, FONT_OBJLIST_INDEX, Qnil); num_fonts++; font = XFONT_OBJECT (font_object); @@ -2807,28 +2791,17 @@ Lisp_Object font_object; { struct font *font = XFONT_OBJECT (font_object); - Lisp_Object objlist; - Lisp_Object tail, prev = Qnil; - - objlist = AREF (font_object, FONT_OBJLIST_INDEX); - for (prev = Qnil, tail = objlist; CONSP (tail); - prev = tail, tail = XCDR (tail)) - if (EQ (font_object, XCAR (tail))) - { - font_add_log ("close", font_object, Qnil); - font->driver->close (f, font); + + if (NILP (AREF (font_object, FONT_TYPE_INDEX))) + /* Already closed. */ + return; + font_add_log ("close", font_object, Qnil); + font->driver->close (f, font); #ifdef HAVE_WINDOW_SYSTEM - font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); - FRAME_X_DISPLAY_INFO (f)->n_fonts--; + font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); + FRAME_X_DISPLAY_INFO (f)->n_fonts--; #endif - if (NILP (prev)) - ASET (font_object, FONT_OBJLIST_INDEX, XCDR (objlist)); - else - XSETCDR (prev, XCDR (objlist)); - num_fonts--; - return; - } - abort (); + num_fonts--; } @@ -3544,7 +3517,6 @@ if (! face->font) return Qnil; - font_assert (font_check_object ((struct font *) face->font)); XSETFONT (font_object, face->font); return font_object; }