mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Load and register ArdourSans font at application start
This commit is contained in:
parent
72bfc67027
commit
a46bbabdaf
5 changed files with 86 additions and 42 deletions
|
|
@ -157,22 +157,38 @@ void load_custom_fonts()
|
|||
*/
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
||||
std::string ardour_mono_file;
|
||||
std::string font_file;
|
||||
|
||||
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
|
||||
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", font_file)) {
|
||||
cerr << _("Cannot find ArdourMono TrueType font") << endl;
|
||||
} else {
|
||||
CFStringRef ttf;
|
||||
CFURLRef fontURL;
|
||||
CFErrorRef error;
|
||||
ttf = CFStringCreateWithBytes(
|
||||
kCFAllocatorDefault, (UInt8*) font_file.c_str(),
|
||||
font_file.length(),
|
||||
kCFStringEncodingUTF8, FALSE);
|
||||
fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, ttf, kCFURLPOSIXPathStyle, TRUE);
|
||||
if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error) != true) {
|
||||
cerr << _("Cannot load ArdourMono TrueType font.") << endl;
|
||||
}
|
||||
}
|
||||
|
||||
CFStringRef ttf;
|
||||
CFURLRef fontURL;
|
||||
CFErrorRef error;
|
||||
ttf = CFStringCreateWithBytes(
|
||||
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;
|
||||
if (!find_file (ardour_data_search_path(), "ArdourSans.ttf", font_file)) {
|
||||
cerr << _("Cannot find ArdourSans TrueType font") << endl;
|
||||
} else {
|
||||
CFStringRef ttf;
|
||||
CFURLRef fontURL;
|
||||
CFErrorRef error;
|
||||
ttf = CFStringCreateWithBytes(
|
||||
kCFAllocatorDefault, (UInt8*) font_file.c_str(),
|
||||
font_file.length(),
|
||||
kCFStringEncodingUTF8, FALSE);
|
||||
fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, ttf, kCFURLPOSIXPathStyle, TRUE);
|
||||
if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error) != true) {
|
||||
cerr << _("Cannot load ArdourSerif TrueType font.") << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue