mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 05:30:43 -08:00
Stop querying for fonts as soon as a match is found
Scanning through fonts can be very slow, especially with the 'x' font backend, and the result is almost always not used. Stop looking for a font as soon as one is found rather than scanning all the backends. * src/font.c (font_list_entities): Stop scanning through the font backends as soon as we find a match unless 'query-all-font-backends is set (Bug#43177). (syms_of_font): New variable 'query-all-font-backends', default false.
This commit is contained in:
parent
0a7152e095
commit
20d13e424f
1 changed files with 14 additions and 1 deletions
15
src/font.c
15
src/font.c
|
|
@ -2810,7 +2810,13 @@ font_list_entities (struct frame *f, Lisp_Object spec)
|
|||
|| ! NILP (Vface_ignored_fonts)))
|
||||
val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
|
||||
if (ASIZE (val) > 0)
|
||||
list = Fcons (val, list);
|
||||
{
|
||||
list = Fcons (val, list);
|
||||
/* Querying further backends can be very slow, so we only do
|
||||
it if the user has explicitly requested it (Bug#43177). */
|
||||
if (query_all_font_backends == false)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list = Fnreverse (list);
|
||||
|
|
@ -5527,6 +5533,13 @@ Non-nil means don't query fontconfig for color fonts, since they often
|
|||
cause Xft crashes. Only has an effect in Xft builds. */);
|
||||
xft_ignore_color_fonts = true;
|
||||
|
||||
DEFVAR_BOOL ("query-all-font-backends", query_all_font_backends,
|
||||
doc: /*
|
||||
If non-nil attempt to query all available font backends.
|
||||
By default Emacs will stop searching for a matching font at the first
|
||||
match. */);
|
||||
query_all_font_backends = false;
|
||||
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
#ifdef HAVE_FREETYPE
|
||||
syms_of_ftfont ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue