From 7a68f092092cec5f0005bab83daa7bdb228bc4ab Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Thu, 28 Jan 2010 13:04:37 -0800 Subject: [PATCH] Fontconfig: simplify font caching process. - Remove FcConfigGetCache(), since it returns NULL in all modern Fontconfig versions. - Remove obsolete code. Fontconfig automatically sets up rescanning intervals for font caches and does not use per-user cache files anymore. - Use FcInitBringUptoDate(), which takes care of all caching issues behind the scenes. For example, it will automatically call FcConfigBuildFonts() and FcConfigSetCurrent(), if necessary. --- lily/font-config.cc | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/lily/font-config.cc b/lily/font-config.cc index a7acda7cba..65ec1b0036 100644 --- a/lily/font-config.cc +++ b/lily/font-config.cc @@ -40,21 +40,7 @@ init_fontconfig () message (_ ("Initializing FontConfig...")); font_config_global = FcInitLoadConfig (); - FcChar8 *cache_file = FcConfigGetCache (font_config_global); -#if 0 - // always returns 0 for FC 2.4 - if (!cache_file) - programming_error ("Cannot find file for FontConfig cache."); -#endif - /* - This is a terrible kludge, but there is apparently no way for - FontConfig to signal whether it needs to rescan directories. - */ - if (cache_file - && !is_file ((char const *)cache_file)) - message (_f ("Rebuilding FontConfig cache %s, this may take a while...", cache_file)); - vector dirs; /* Extra trailing slash suddenly breaks fontconfig (fc-cache 2.5.0) @@ -73,20 +59,12 @@ init_fontconfig () if (be_verbose_global) message (_ ("Building font database.")); - FcConfigBuildFonts (font_config_global); - FcConfigSetCurrent (font_config_global); + + FcInitBringUptoDate (); + if (be_verbose_global) message ("\n"); - if (cache_file - && !is_file ((char*)cache_file)) - { - /* inhibit future messages. */ - FILE *f = fopen ((char*)cache_file, "w"); - if (f) - fclose (f); - } - } #else -- 2.39.2