[gtk/fontconfig-speedup: 3/3] Trigger fontconfig initialization early




commit 09b88dc90c297443b018d282dc91fb17c35af667
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 19 14:20:41 2020 -0400

    Trigger fontconfig initialization early
    
    Add a pango call to create the fontmap already in gtk_init.
    This will let us hide the cost of FcInit() (which on font-heavy
    systems can be ~100ms) in a thread, on the pango side.

 gtk/gtkmain.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index f59f1403cc..a517a0e6e7 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -623,6 +623,9 @@ do_pre_parse_initialization (void)
       slowdown = g_ascii_strtod (env_string, NULL);
       _gtk_set_slowdown (slowdown);
     }
+
+  /* Trigger fontconfig initialization early */
+  pango_cairo_font_map_get_default ();
 }
 
 static void


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