Commit 4658d361 authored by rgiot's avatar rgiot Committed by Gargaj
Browse files

Change Linux font path if required (#35)

* Change Linux font path if required

* Make the font paht choice at run (and not compilation)

* Fix (I hope so) win64 construction

* Downgrade c++ version

* Seems that all C++ version are unable to convert string to char *...

* Use a C-like file existence check and remove uneeded #ifndef

* Still a blind tentative to compile on windows
parent cb93d0ac
......@@ -11,6 +11,7 @@ set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_PATCH "0")
option(BONZOMATIC_64BIT "Compile for 64 bit target?" ON)
if (MSVC)
if (CMAKE_GENERATOR MATCHES "64")
......
......@@ -2,6 +2,8 @@
#include <string.h>
#include <assert.h>
#include "ShaderEditor.h"
#include "Renderer.h"
#include "FFT.h"
......@@ -14,6 +16,8 @@
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
void ReplaceTokens( std::string &sDefShader, const char * sTokenBegin, const char * sTokenName, const char * sTokenEnd, std::vector<std::string> &tokens )
......@@ -117,7 +121,22 @@ int main()
#elif __APPLE__
options.sFontPath = "/Library/Fonts/Courier New.ttf";
#else
options.sFontPath = "/usr/share/fonts/corefonts/cour.ttf";
// Linux case
const std::string fontPaths[2] = {
"/usr/share/fonts/corefonts/cour.ttf",
"/usr/share/fonts/truetype/msttcorefonts/cour.ttf"
};
options.sFontPath = "";
int step = 0;
while(step <2 && options.sFontPath.size() ==0) {
const std::string & current = fontPaths[step++];
if (access(current.c_str(), R_OK) != -1) {
options.sFontPath = current;
}
}
assert(options.sFontPath.size()>0 );
#endif
options.nOpacity = 0xC0;
options.bUseSpacesForTabs = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment