]> git.donarmstrong.com Git - lilypond.git/blob - lily/font-config.cc
* buildscripts/gen-emmentaler-scripts.py (i): generate
[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   dirs.push (prefix_directory + "/cff/");
36   
37   for (int i = 0; i < dirs.size(); i++)
38     {
39       String path = dirs[i];
40       if (!FcConfigAppFontAddDir (fcc, (FcChar8*)path.to_str0 ()))
41         {
42           error (_f ("Failed to add lilypond directory %s", path.to_str0 ()));
43         }
44     }     
45 }
46
47 #else
48
49 void init_fontconfig() {}
50 #endif