OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "file-path.hh" | 28 #include "file-path.hh" |
29 #include "international.hh" | 29 #include "international.hh" |
30 #include "main.hh" | 30 #include "main.hh" |
31 #include "warn.hh" | 31 #include "warn.hh" |
32 | 32 |
33 FcConfig *font_config_global = 0; | 33 FcConfig *font_config_global = 0; |
34 | 34 |
35 void | 35 void |
36 init_fontconfig () | 36 init_fontconfig () |
37 { | 37 { |
38 if (be_verbose_global) | 38 debug_output (_ ("Initializing FontConfig...")); |
39 message (_ ("Initializing FontConfig...")); | |
40 | 39 |
41 /* TODO: Find a way for Fontconfig to update its cache, if needed. */ | 40 /* TODO: Find a way for Fontconfig to update its cache, if needed. */ |
42 font_config_global = FcInitLoadConfig (); | 41 font_config_global = FcInitLoadConfig (); |
43 | 42 |
44 vector<string> dirs; | 43 vector<string> dirs; |
45 | 44 |
46 /* Extra trailing slash suddenly breaks fontconfig (fc-cache 2.5.0) | 45 /* Extra trailing slash suddenly breaks fontconfig (fc-cache 2.5.0) |
47 on windows. */ | 46 on windows. */ |
48 dirs.push_back (lilypond_datadir + "/fonts/otf"); | 47 dirs.push_back (lilypond_datadir + "/fonts/otf"); |
49 | 48 |
50 for (vsize i = 0; i < dirs.size (); i++) | 49 for (vsize i = 0; i < dirs.size (); i++) |
51 { | 50 { |
52 string dir = dirs[i]; | 51 string dir = dirs[i]; |
53 if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ())) | 52 if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ())) |
54 error (_f ("failed adding font directory: %s", dir.c_str ())); | 53 error (_f ("failed adding font directory: %s", dir.c_str ())); |
55 else if (be_verbose_global) | 54 else |
56 message (_f ("adding font directory: %s", dir.c_str ())); | 55 debug_output (_f ("Adding font directory: %s", dir.c_str ())); |
57 } | 56 } |
58 | 57 |
59 if (be_verbose_global) | 58 debug_output (_ ("Building font database...")); |
60 message (_ ("Building font database...")); | |
61 | 59 |
62 FcConfigBuildFonts (font_config_global); | 60 FcConfigBuildFonts (font_config_global); |
63 FcConfigSetCurrent (font_config_global); | 61 FcConfigSetCurrent (font_config_global); |
64 | 62 |
65 if (be_verbose_global) | 63 debug_output ("\n"); |
66 message ("\n"); | |
67 | 64 |
68 } | 65 } |
69 | 66 |
70 #else | 67 #else |
71 | 68 |
72 void | 69 void |
73 init_fontconfig () | 70 init_fontconfig () |
74 { | 71 { |
75 } | 72 } |
76 | 73 |
77 #endif | 74 #endif |
OLD | NEW |