OSX CoreText font loading, updated ArdourMono font-family name
authorRobin Gareus <robin@gareus.org>
Thu, 31 Jan 2013 07:41:37 +0000 (07:41 +0000)
committerRobin Gareus <robin@gareus.org>
Thu, 31 Jan 2013 07:41:37 +0000 (07:41 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@14042 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ArdourMono.ttf
gtk2_ardour/main.cc

index e6f91cda836247676715daa9998a055937757960..d4c93d1f91b6b6610385a34134eb5ca9da29c182 100644 (file)
Binary files a/gtk2_ardour/ArdourMono.ttf and b/gtk2_ardour/ArdourMono.ttf differ
index 381f97d82f9e0ad133efb18c5c814648ed616b89..8b7a8772b2cf1594cc89e0a7a0b7bd694abbb415 100644 (file)
@@ -217,6 +217,30 @@ 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)) {
+               cerr << _("Cannot find ArdourMono TrueType font") << endl;
+       }
+
+       CFStringRef ttf;
+       CFURLRef fontURL;
+       CFErrorRef error;
+       ttf = CFStringCreateWithBytes(
+                       kCFAllocatorDefault, ardour_mono_filec_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
 
 void
@@ -319,8 +343,6 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
 
 }
 
-#endif
-
 static void load_custom_fonts() {
        std::string ardour_mono_file;
        if (!find_file_in_search_path (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
@@ -338,6 +360,8 @@ static void load_custom_fonts() {
        }
 }
 
+#endif
+
 static gboolean
 tell_about_jack_death (void* /* ignored */)
 {