OSX font loading
authorRobin Gareus <robin@gareus.org>
Fri, 22 Feb 2013 15:48:44 +0000 (15:48 +0000)
committerRobin Gareus <robin@gareus.org>
Fri, 22 Feb 2013 15:48:44 +0000 (15:48 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@14090 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/main.cc

index ca50e4a97dc46022badcc654f874e54c79c2c414..850b1141d13c6ace0c2b183af4e85d83ea3e8a4d 100644 (file)
 
 #include "i18n.h"
 
+#ifdef __APPLE__
+#include <Carbon/Carbon.h>
+#endif
+
 using namespace std;
 using namespace Gtk;
 using namespace ARDOUR_COMMAND_LINE;
@@ -217,10 +221,7 @@ fixup_bundle_environment (int, char* [])
        setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (bundle_dir, "Resources/gdk-pixbuf.loaders").c_str(), 1);
 }
 
-#include <Carbon/Carbon.h>
-
 static void load_custom_fonts() {
-#if 0 // untested OSX code
        std::string ardour_mono_file;
 
        if (!find_file_in_search_path (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
@@ -231,14 +232,13 @@ static void load_custom_fonts() {
        CFURLRef fontURL;
        CFErrorRef error;
        ttf = CFStringCreateWithBytes(
-                       kCFAllocatorDefault, ardour_mono_filec_str(),
+                       kCFAllocatorDefault, (UInt8*) ardour_mono_file.c_str(),
                        ardour_mono_file.length(),
                        kCFStringEncodingUTF8, FALSE);
        fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, ttf, kCFURLPOSIXPathStyle, TRUE);
        if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error) != true) {
                cerr << _("Cannot load ArdourMono TrueType font.") << endl;
        }
-#endif
 }
 
 #else