]> git.donarmstrong.com Git - lilypond.git/blob - lily/font-config.cc
531a76df7643d65738f82f870494f5d53b69cb40
[lilypond.git] / lily / font-config.cc
1 /*
2   font-config.cc -- implement FontConfig related functions
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "config.hh"
10
11 #ifdef HAVE_FONTCONFIG
12
13 #include <fontconfig/fontconfig.h>
14
15 #include "file-path.hh"
16 #include "main.hh"
17 #include "warn.hh"
18
19 void
20 init_fontconfig ()
21 {
22   if (be_verbose_global)
23     progress_indication (_("Initializing FontConfig ..."));
24   
25   if (!FcInit ())
26     error (_ ("FontConfig failed to initialize"));
27
28   FcConfig *fcc = FcConfigGetCurrent ();
29
30   Array<String> dirs;
31   dirs.push (prefix_directory + "/fonts/otf/");
32   dirs.push (prefix_directory + "/mf/out/");
33   dirs.push (prefix_directory + "/fonts/type1/");
34   dirs.push (prefix_directory + "/fonts/cff/");
35
36   for (int i = 0; i < dirs.size (); i++)
37     {
38       String dir = dirs[i];
39       if (!FcConfigAppFontAddDir (fcc, (FcChar8 *)dir.to_str0 ()))
40         error (_f ("Failed to add lilypond directory %s", dir));
41     }
42
43   if (be_verbose_global)
44     progress_indication ("\n");
45 }
46
47 #else
48
49 void
50 init_fontconfig ()
51 {
52 }
53 #endif