]> git.donarmstrong.com Git - lilypond.git/blob - lily/font-config.cc
* lily/font-config.cc (init_fontconfig): add
[lilypond.git] / lily / font-config.cc
1 /*
2   font-config.cc -- implement Font_config 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
10 #include "config.hh"
11
12 #ifdef HAVE_PANGO_FT2
13
14 #include <fontconfig/fontconfig.h>
15
16 #include "main.hh"
17 #include "warn.hh"
18 #include "file-path.hh"
19
20 void
21 init_fontconfig ()
22 {
23   if (!FcInit())
24     {
25       error ("FontConfig failed to initialize"); 
26     }
27
28   FcConfig *fcc = FcConfigGetCurrent ();
29
30   
31   Array<String> dirs;
32   dirs.push (prefix_directory + "/otf/");
33   dirs.push (prefix_directory + "/mf/out/");
34   dirs.push (prefix_directory + "/type1/");
35   
36   for (int i = 0; i < dirs.size(); i++)
37     {
38       String path = dirs[i];
39       if (!FcConfigAppFontAddDir (fcc, (FcChar8*)path.to_str0 ()))
40         {
41           error (_f ("Failed to add lilypond directory %s", path.to_str0 ()));
42         }
43     }     
44 }
45
46 #else
47
48 void init_fontconfig() {}
49 #endif