]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fontconfig: simplify font caching process.
authorPatrick McCarty <pnorcks@gmail.com>
Thu, 28 Jan 2010 21:04:37 +0000 (13:04 -0800)
committerPatrick McCarty <pnorcks@gmail.com>
Thu, 28 Jan 2010 21:16:05 +0000 (13:16 -0800)
- 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

index a7acda7cbad5b282e7acbcbe846d64fce07dfc00..65ec1b003672193f0c2014d948e24815b0a48b45 100644 (file)
@@ -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<string> 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