aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-10-03 07:46:53 +0400
committerDmitry Antipov2014-10-03 07:46:53 +0400
commite197284d4789d7caa613fc406516f58fbec02547 (patch)
tree68f5403b1bd41ebc3b19784f969fbc815b9430b6
parentf0db3488160698cb48206d53742f938b71d1aeeb (diff)
downloademacs-e197284d4789d7caa613fc406516f58fbec02547.tar.gz
emacs-e197284d4789d7caa613fc406516f58fbec02547.zip
* 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 an entity itself (Bug#17125).
-rw-r--r--src/ChangeLog6
-rw-r--r--src/font.c35
2 files changed, 25 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 331da12aa13..9354aa09fa4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-10-03 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * font.c (font_list_entities): Do not add empty vector to font cache.
4 (font_matching_entity): Likewise. If matching entity is found, insert
5 1-item vector with this entity instead of an entity itself (Bug#17125).
6
12014-10-02 Eli Zaretskii <eliz@gnu.org> 72014-10-02 Eli Zaretskii <eliz@gnu.org>
2 8
3 * xdisp.c (move_it_by_lines): Call reseat_1 after moving the 9 * xdisp.c (move_it_by_lines): Call reseat_1 after moving the
diff --git a/src/font.c b/src/font.c
index 470fa1adc11..95b22b2fceb 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2756,22 +2756,21 @@ font_list_entities (struct frame *f, Lisp_Object spec)
2756 val = XCDR (val); 2756 val = XCDR (val);
2757 else 2757 else
2758 { 2758 {
2759 Lisp_Object copy;
2760
2761 val = driver_list->driver->list (f, scratch_font_spec); 2759 val = driver_list->driver->list (f, scratch_font_spec);
2762 if (NILP (val)) 2760 if (!NILP (val))
2763 val = zero_vector; 2761 {
2764 else 2762 Lisp_Object copy = copy_font_spec (scratch_font_spec);
2765 val = Fvconcat (1, &val); 2763
2766 copy = copy_font_spec (scratch_font_spec); 2764 val = Fvconcat (1, &val);
2767 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2765 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2768 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); 2766 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
2767 }
2769 } 2768 }
2770 if (ASIZE (val) > 0 2769 if (VECTORP (val) && ASIZE (val) > 0
2771 && (need_filtering 2770 && (need_filtering
2772 || ! NILP (Vface_ignored_fonts))) 2771 || ! NILP (Vface_ignored_fonts)))
2773 val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); 2772 val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
2774 if (ASIZE (val) > 0) 2773 if (VECTORP (val) && ASIZE (val) > 0)
2775 list = Fcons (val, list); 2774 list = Fcons (val, list);
2776 } 2775 }
2777 2776
@@ -2807,18 +2806,22 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
2807 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) 2806 && (NILP (ftype) || EQ (driver_list->driver->type, ftype)))
2808 { 2807 {
2809 Lisp_Object cache = font_get_cache (f, driver_list->driver); 2808 Lisp_Object cache = font_get_cache (f, driver_list->driver);
2810 Lisp_Object copy;
2811 2809
2812 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); 2810 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type);
2813 entity = assoc_no_quit (work, XCDR (cache)); 2811 entity = assoc_no_quit (work, XCDR (cache));
2814 if (CONSP (entity)) 2812 if (CONSP (entity))
2815 entity = XCDR (entity); 2813 entity = AREF (XCDR (entity), 0);
2816 else 2814 else
2817 { 2815 {
2818 entity = driver_list->driver->match (f, work); 2816 entity = driver_list->driver->match (f, work);
2819 copy = copy_font_spec (work); 2817 if (!NILP (entity))
2820 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2818 {
2821 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2819 Lisp_Object copy = copy_font_spec (work);
2820 Lisp_Object match = Fvector (1, &entity);
2821
2822 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2823 XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache)));
2824 }
2822 } 2825 }
2823 if (! NILP (entity)) 2826 if (! NILP (entity))
2824 break; 2827 break;