2 font-config.cc -- implement FontConfig related functions
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
13 #include <fontconfig/fontconfig.h>
15 #include "file-path.hh"
22 if (be_verbose_global)
23 message (_ ("Initializing FontConfig..."));
26 error (_ ("initializing FontConfig"));
28 FcConfig *fcc = FcConfigGetCurrent ();
30 FcChar8 *cache = FcConfigGetCache (fcc);
31 if (!FcDirCacheValid (cache))
33 warning (_ ("FontConfig cache out of date. Rebuilding may take some time."));
38 String builddir = prefix_directory + "/mf/out/";
40 if (stat (builddir.to_str0 (), &statbuf) == 0)
41 dirs.push (builddir.to_str0 ());
44 dirs.push (prefix_directory + "/fonts/otf/");
45 dirs.push (prefix_directory + "/fonts/type1/");
46 dirs.push (prefix_directory + "/fonts/svg/");
49 for (int i = 0; i < dirs.size (); i++)
52 if (!FcConfigAppFontAddDir (fcc, (FcChar8 *)dir.to_str0 ()))
53 error (_f ("adding font directory: %s", dir.to_str0 ()));
54 else if (be_verbose_global)
55 message (_f ("adding font directory: %s", dir.to_str0 ()));
58 if (be_verbose_global)
59 progress_indication ("\n");