]> git.eshelyaron.com Git - emacs.git/commitdiff
* font.c (font_list_entities): Do not add empty vector to font cache.
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 2 Apr 2014 13:24:19 +0000 (17:24 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 2 Apr 2014 13:24:19 +0000 (17:24 +0400)
(font_matching_entity): Likewise.  If matching entity is found, insert
1-item vector with this entity instead of entity itself (Bug#17125).

src/ChangeLog
src/font.c

index 6889fa9b4e671a5177622479fbfe52a24d8773f0..2f028c482476fca3afe6abb1730f96b65a8d2918 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-02  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * font.c (font_list_entities): Do not add empty vector to font cache.
+       (font_matching_entity): Likewise.  If matching entity is found, insert
+       1-item vector with this entity instead of entity itself (Bug#17125).
+
 2014-04-01  Paul Eggert  <eggert@cs.ucla.edu>
 
        * fns.c (validate_subarray): Rename from validate_substring,
index b49664b5f31f6b16c68d7ca3336f42c8252cabc4..e99141bfe5c3346b3cd1ac838865aab19b075679 100644 (file)
@@ -2753,22 +2753,21 @@ font_list_entities (struct frame *f, Lisp_Object spec)
          val = XCDR (val);
        else
          {
-           Lisp_Object copy;
-
            val = driver_list->driver->list (f, scratch_font_spec);
-           if (NILP (val))
-             val = zero_vector;
-           else
-             val = Fvconcat (1, &val);
-           copy = copy_font_spec (scratch_font_spec);
-           ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
-           XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
+           if (!NILP (val))
+             {
+               Lisp_Object copy = copy_font_spec (scratch_font_spec);
+
+               val = Fvconcat (1, &val);
+               ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
+               XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
+             }
          }
-       if (ASIZE (val) > 0
+       if (VECTORP (val) && ASIZE (val) > 0
            && (need_filtering
                || ! NILP (Vface_ignored_fonts)))
          val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
-       if (ASIZE (val) > 0)
+       if (VECTORP (val) && ASIZE (val) > 0)
          list = Fcons (val, list);
       }
 
@@ -2804,7 +2803,6 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
        && (NILP (ftype) || EQ (driver_list->driver->type, ftype)))
       {
        Lisp_Object cache = font_get_cache (f, driver_list->driver);
-       Lisp_Object copy;
 
        ASET (work, FONT_TYPE_INDEX, driver_list->driver->type);
        entity = assoc_no_quit (work, XCDR (cache));
@@ -2813,9 +2811,14 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
        else
          {
            entity = driver_list->driver->match (f, work);
-           copy = copy_font_spec (work);
-           ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
-           XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
+           if (!NILP (entity))
+             {
+               Lisp_Object copy = copy_font_spec (work);
+               Lisp_Object match = Fvector (1, &entity);
+
+               ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
+               XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache)));
+             }
          }
        if (! NILP (entity))
          break;