changeset 102897:9a6e5b1105a6

(font_put_extra): If VAL is nil, delete the slot for PROP from the list of extra properties. (font_clear_prop): Be sure to delete `:name' font property.
author Kenichi Handa <handa@m17n.org>
date Thu, 09 Apr 2009 02:40:39 +0000
parents 5967d3d57ee8
children 62b8c5608b1d
files src/font.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Thu Apr 09 02:32:39 2009 +0000
+++ b/src/font.c	Thu Apr 09 02:40:39 2009 +0000
@@ -719,6 +719,8 @@
     {
       Lisp_Object prev = Qnil;
 
+      if (NILP (val))
+	return val;
       while (CONSP (extra)
 	     && NILP (Fstring_lessp (prop, XCAR (XCAR (extra)))))
 	prev = extra, extra = XCDR (extra);
@@ -729,6 +731,8 @@
       return val;
     }
   XSETCDR (slot, val);
+  if (NILP (val))
+    ASET (font, FONT_EXTRA_INDEX, Fdelq (slot, extra));
   return val;
 }
 
@@ -3078,13 +3082,20 @@
 
   if (! FONTP (font))
     return;
+  if (! NILP (Ffont_get (font, QCname)))
+    {
+      font = Fcopy_font_spec (font);
+      font_put_extra (font, QCname, Qnil);
+    }
+
   if (NILP (AREF (font, prop))
       && prop != FONT_FAMILY_INDEX
       && prop != FONT_FOUNDRY_INDEX
       && prop != FONT_WIDTH_INDEX
       && prop != FONT_SIZE_INDEX)
     return;
-  font = Fcopy_font_spec (font);
+  if (EQ (font, attrs[LFACE_FONT_INDEX]))
+    font = Fcopy_font_spec (font);
   ASET (font, prop, Qnil);
   if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX)
     {