aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-04-02 17:24:19 +0400
committerDmitry Antipov2014-04-02 17:24:19 +0400
commitaf1a69f4d17a482c359d98c00ef86fac835b5fac (patch)
tree48d1ec3fed1ab0b5db94c43e1e8702329d5020a2
parent200c532bd04a67a89db602462d74706051c61178 (diff)
downloademacs-af1a69f4d17a482c359d98c00ef86fac835b5fac.tar.gz
emacs-af1a69f4d17a482c359d98c00ef86fac835b5fac.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 entity itself (Bug#17125).
-rw-r--r--src/ChangeLog6
-rw-r--r--src/font.c33
2 files changed, 24 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6889fa9b4e6..2f028c48247 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-04-02 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 entity itself (Bug#17125).
6
12014-04-01 Paul Eggert <eggert@cs.ucla.edu> 72014-04-01 Paul Eggert <eggert@cs.ucla.edu>
2 8
3 * fns.c (validate_subarray): Rename from validate_substring, 9 * fns.c (validate_subarray): Rename from validate_substring,
diff --git a/src/font.c b/src/font.c
index b49664b5f31..e99141bfe5c 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2753,22 +2753,21 @@ font_list_entities (struct frame *f, Lisp_Object spec)
2753 val = XCDR (val); 2753 val = XCDR (val);
2754 else 2754 else
2755 { 2755 {
2756 Lisp_Object copy;
2757
2758 val = driver_list->driver->list (f, scratch_font_spec); 2756 val = driver_list->driver->list (f, scratch_font_spec);
2759 if (NILP (val)) 2757 if (!NILP (val))
2760 val = zero_vector; 2758 {
2761 else 2759 Lisp_Object copy = copy_font_spec (scratch_font_spec);
2762 val = Fvconcat (1, &val); 2760
2763 copy = copy_font_spec (scratch_font_spec); 2761 val = Fvconcat (1, &val);
2764 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2762 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2765 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); 2763 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
2764 }
2766 } 2765 }
2767 if (ASIZE (val) > 0 2766 if (VECTORP (val) && ASIZE (val) > 0
2768 && (need_filtering 2767 && (need_filtering
2769 || ! NILP (Vface_ignored_fonts))) 2768 || ! NILP (Vface_ignored_fonts)))
2770 val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); 2769 val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
2771 if (ASIZE (val) > 0) 2770 if (VECTORP (val) && ASIZE (val) > 0)
2772 list = Fcons (val, list); 2771 list = Fcons (val, list);
2773 } 2772 }
2774 2773
@@ -2804,7 +2803,6 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
2804 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) 2803 && (NILP (ftype) || EQ (driver_list->driver->type, ftype)))
2805 { 2804 {
2806 Lisp_Object cache = font_get_cache (f, driver_list->driver); 2805 Lisp_Object cache = font_get_cache (f, driver_list->driver);
2807 Lisp_Object copy;
2808 2806
2809 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); 2807 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type);
2810 entity = assoc_no_quit (work, XCDR (cache)); 2808 entity = assoc_no_quit (work, XCDR (cache));
@@ -2813,9 +2811,14 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
2813 else 2811 else
2814 { 2812 {
2815 entity = driver_list->driver->match (f, work); 2813 entity = driver_list->driver->match (f, work);
2816 copy = copy_font_spec (work); 2814 if (!NILP (entity))
2817 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2815 {
2818 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2816 Lisp_Object copy = copy_font_spec (work);
2817 Lisp_Object match = Fvector (1, &entity);
2818
2819 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2820 XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache)));
2821 }
2819 } 2822 }
2820 if (! NILP (entity)) 2823 if (! NILP (entity))
2821 break; 2824 break;