mingw environment: ArdourMono.ttf
[ardour.git] / gtk2_ardour / bundle_env_mingw.cc
1 /*
2     Copyright (C) 2001-2012 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "bundle_env.h"
21 #include "i18n.h"
22
23 #include <fontconfig/fontconfig.h>
24
25 #include "ardour/ardour.h"
26 #include "ardour/search_paths.h"
27 #include "ardour/filesystem_paths.h"
28
29 #include "pbd/file_utils.h"
30 #include "pbd/epa.h"
31
32 using namespace std;
33 using namespace PBD;
34 using namespace ARDOUR;
35
36
37 void
38 fixup_bundle_environment (int, char* [], const char** localedir)
39 {
40         /* what to do ? */
41 }
42
43 void load_custom_fonts() 
44 {
45         std::string ardour_mono_file;
46
47         if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
48                 cerr << _("Cannot find ArdourMono TrueType font") << endl;
49         }
50
51         FcConfig *config = FcInitLoadConfigAndFonts();
52         FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(ardour_mono_file.c_str()));
53
54         if (ret == FcFalse) {
55                 cerr << _("Cannot load ArdourMono TrueType font.") << endl;
56         }
57
58         ret = FcConfigSetCurrent(config);
59
60         if (ret == FcFalse) {
61                 cerr << _("Failed to set fontconfig configuration.") << endl;
62         }
63 }