OSX bundled font fix-up

This commit is contained in:
Charles J. Cliffe
2016-06-28 19:36:37 -04:00
parent a8c4b09655
commit 464055ff57
3 changed files with 42 additions and 20 deletions
+11 -11
View File
@@ -149,17 +149,17 @@ bool CubicSDR::OnInit() {
//better (by default, was "C" locale).
std::setlocale(LC_ALL, "");
#ifdef _OSX_APP_
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
{
// error!
}
CFRelease(resourcesURL);
chdir(path);
#endif
//#ifdef _OSX_APP_
// CFBundleRef mainBundle = CFBundleGetMainBundle();
// CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
// char path[PATH_MAX];
// if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
// {
// // error!
// }
// CFRelease(resourcesURL);
// chdir(path);
//#endif
if (!wxApp::OnInit()) {
return false;
+18 -1
View File
@@ -5,6 +5,10 @@
#include <algorithm>
#include "cubic_math.h"
#ifdef _OSX_APP_
#include "CoreFoundation/CoreFoundation.h"
#endif
static std::wstring getExePath(void)
{
//get the dir path of the executable
@@ -201,8 +205,21 @@ void GLFont::loadFontOnce() {
return;
}
#if _OSX_APP_
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
{
// error!
}
CFRelease(resourcesURL);
wxString resourceFolder = std::string(path) + "/";
#else
wxString resourceFolder = RES_FOLDER;
#endif
//full font file path
wxFileName fontDefFileName = wxFileName(resourceFolder + L"/" + fontDefFileSource);