diff options
author | Eli Zaretskii <eliz@gnu.org> | 2017-04-16 10:43:22 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2017-04-16 10:43:22 +0300 |
commit | 58430f29968a5661caff630d20dbbe7c864fe08d (patch) | |
tree | 8ec9d9d392f08b16e39c1d3c5a5c5824d5239a60 | |
parent | f3b24e90dc9fad355102e1fdf2828ca33d447a07 (diff) | |
download | emacs-58430f29968a5661caff630d20dbbe7c864fe08d.tar.gz |
Fix redisplay performance problems with some fonts
* src/font.c (font_list_entities): Revert part of the changes
introduced on Apr 2, 2014 to fix bug#17125. It turns out having
zero_vector in the font-cache is an important indication that
cannot be removed. (Bug#21028)
-rw-r--r-- | src/font.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/font.c b/src/font.c index a929509752c..dd6191b2b1f 100644 --- a/src/font.c +++ b/src/font.c @@ -2777,21 +2777,27 @@ font_list_entities (struct frame *f, Lisp_Object spec) val = XCDR (val); else { - val = driver_list->driver->list (f, scratch_font_spec); - if (!NILP (val)) - { - Lisp_Object copy = copy_font_spec (scratch_font_spec); + Lisp_Object copy; - val = Fvconcat (1, &val); - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); - XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); - } + val = driver_list->driver->list (f, scratch_font_spec); + /* We put zero_vector in the font-cache to indicate that + no fonts matching SPEC were found on the system. + Failure to have this indication in the font cache can + cause severe performance degradation in some rare + cases, see bug#21028. */ + 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 (VECTORP (val) && ASIZE (val) > 0 + if (ASIZE (val) > 0 && (need_filtering || ! NILP (Vface_ignored_fonts))) val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); - if (VECTORP (val) && ASIZE (val) > 0) + if (ASIZE (val) > 0) list = Fcons (val, list); } |