bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43177: Bug: Emacs 27.1 hangs forever in `FcCharSetSubtractCount' fro


From: Robert Pluim
Subject: bug#43177: Bug: Emacs 27.1 hangs forever in `FcCharSetSubtractCount' from '/usr/lib/libfontconfig.so.1'
Date: Fri, 04 Sep 2020 15:05:52 +0200

>>>>> On Fri, 04 Sep 2020 15:22:58 +0300, Eli Zaretskii <eliz@gnu.org> said:
    Eli> I don't think this would help, because most scripts don't specify
    Eli> language properties like 'ja' or 'ko', which is what
    Eli> xfont_supported_scripts uses.

ok

    >> Perhaps we should flip the default of scalable-fonts-allowed to nil
    >> under GNU/Linux? [1]
    >> (unless the only available font-backend is 'x', which can only happen
    >> if the user explicitly sets it that way)?

    Eli> That'd be backward-incompatible.  Besides, I think it's too late.  I
    Eli> think we should do this in font.c, where the 'list' method of each
    Eli> font backend is called.  There, we should not call the 'x' backend
    Eli> unless the no fonts were found by the backend called before it.  This
    Eli> should be controlled by a variable exposed to Lisp, of course.

    Eli> Does that make sense?

Yes. Something like the following works, and makes displaying
etc/HELLO quite a bit faster.

diff --git a/src/font.c b/src/font.c
index 2786a772dc..6bff3a7362 100644
--- a/src/font.c
+++ b/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 @@ syms_of_font (void)
 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: /*
+Non-nil means attempt to query all available font backends when
+looking up a font, otherwise stop as soon as a suitable font has been
+found.  */);
+  query_all_font_backends = false;
+
 #ifdef HAVE_WINDOW_SYSTEM
 #ifdef HAVE_FREETYPE
   syms_of_ftfont ();







reply via email to

[Prev in Thread] Current Thread [Next in Thread]