From 7dc1bc3476ade2ea9aa7af9101e28be3ba8a0dc0 Mon Sep 17 00:00:00 2001 From: mathusummut Date: Mon, 5 Nov 2018 22:30:35 +0100 Subject: [PATCH] Fixed font string on Windows --- source/glest_game/facilities/game_util.cpp | 2 -- source/glest_game/global/lang.cpp | 26 +++++++++---------- source/glest_game/main/main.cpp | 4 +-- .../menu/menu_state_graphic_info.cpp | 12 ++++----- source/shared_lib/sources/graphics/font.cpp | 12 ++++----- .../sources/graphics/gl/font_textFTGL.cpp | 22 ++++++++-------- .../sound/openal/sound_player_openal.cpp | 4 +-- 7 files changed, 40 insertions(+), 42 deletions(-) diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index 64ad70579..51f632ad8 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -338,8 +338,6 @@ namespace Game { result = originalBasePath + uniqueFilePath; } - printf("\nPath: %s\n", result.c_str()); - if (SystemFlags::VERBOSE_MODE_ENABLED) printf("result [%s]\n", result.c_str()); diff --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp index ed813ac0e..777595670 100644 --- a/source/glest_game/global/lang.cpp +++ b/source/glest_game/global/lang.cpp @@ -121,27 +121,27 @@ namespace Game { strToBool(lang.getString("FONT_RIGHTTOLEFT_MIXED_SUPPORT")); } - if (lang.hasString("ZETAGLEST_FONT")) { - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese + if (lang.hasString("GAME_FONT")) { + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese #if defined(WIN32) string newEnvValue = - "ZETAGLEST_FONT=" + lang.getString("ZETAGLEST_FONT"); + "GAME_FONT=" + lang.getString("GAME_FONT"); _putenv(newEnvValue.c_str()); #else - setenv("ZETAGLEST_FONT", - lang.getString("ZETAGLEST_FONT").c_str(), 0); + setenv("GAME_FONT", + lang.getString("GAME_FONT").c_str(), 0); #endif } - if (lang.hasString("ZETAGLEST_FONT_FAMILY")) { + if (lang.hasString("GAME_FONT_FAMILY")) { #if defined(WIN32) string newEnvValue = - "ZETAGLEST_FONT_FAMILY=" + - lang.getString("ZETAGLEST_FONT_FAMILY"); + "GAME_FONT_FAMILY=" + + lang.getString("GAME_FONT_FAMILY"); _putenv(newEnvValue.c_str()); #else - setenv("ZETAGLEST_FONT_FAMILY", - lang.getString("ZETAGLEST_FONT_FAMILY").c_str(), 0); + setenv("GAME_FONT_FAMILY", + lang.getString("GAME_FONT_FAMILY").c_str(), 0); #endif } @@ -195,10 +195,10 @@ namespace Game { strToBool(lang.getString("FONT_RIGHTTOLEFT_WINDOWS")); } - if (lang.hasString("ZETAGLEST_FONT_WINDOWS")) { - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese + if (lang.hasString("GAME_FONT_WINDOWS")) { + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese string newEnvValue = - "ZETAGLEST_FONT=" + lang.getString("ZETAGLEST_FONT_WINDOWS"); + "GAME_FONT=" + lang.getString("GAME_FONT_WINDOWS"); _putenv(newEnvValue.c_str()); } diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 035a511ab..224566d9c 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -7137,10 +7137,10 @@ namespace Game { #if defined(WIN32) string - newEnvValue = "ZETAGLEST_FONT=" + newfont; + newEnvValue = "GAME_FONT=" + newfont; _putenv(newEnvValue.c_str()); #else - setenv("ZETAGLEST_FONT", newfont.c_str(), 1); + setenv("GAME_FONT", newfont.c_str(), 1); #endif } else { printf diff --git a/source/glest_game/menu/menu_state_graphic_info.cpp b/source/glest_game/menu/menu_state_graphic_info.cpp index eefd0585e..9f5b5af8b 100644 --- a/source/glest_game/menu/menu_state_graphic_info.cpp +++ b/source/glest_game/menu/menu_state_graphic_info.cpp @@ -73,9 +73,9 @@ namespace Game { string strInternalInfo = ""; strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported()); - if (getenv("ZETAGLEST_FONT") != NULL) { - char *tryFont = getenv("ZETAGLEST_FONT"); - strInternalInfo += "\nZETAGLEST_FONT: " + string(tryFont); + if (getenv("GAME_FONT") != NULL) { + char *tryFont = getenv("GAME_FONT"); + strInternalInfo += "\nGAME_FONT: " + string(tryFont); } strInternalInfo += "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts); @@ -127,9 +127,9 @@ namespace Game { string strInternalInfo = ""; strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported()); - if (getenv("ZETAGLEST_FONT") != NULL) { - char *tryFont = getenv("ZETAGLEST_FONT"); - strInternalInfo += "\nZETAGLEST_FONT: " + string(tryFont); + if (getenv("GAME_FONT") != NULL) { + char *tryFont = getenv("GAME_FONT"); + strInternalInfo += "\nGAME_FONT: " + string(tryFont); } strInternalInfo += "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts); diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index 0c886fcfb..67099bf66 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -92,13 +92,13 @@ namespace Shared { Font::langHeightText = "yW"; #if defined(WIN32) - string newEnvValue = "ZETAGLEST_FONT="; + string newEnvValue = "GAME_FONT="; _putenv(newEnvValue.c_str()); - newEnvValue = "ZETAGLEST_FONT_FAMILY="; + newEnvValue = "GAME_FONT_FAMILY="; _putenv(newEnvValue.c_str()); #else - unsetenv("ZETAGLEST_FONT"); - unsetenv("ZETAGLEST_FONT_FAMILY"); + unsetenv("GAME_FONT"); + unsetenv("GAME_FONT_FAMILY"); #endif } @@ -609,8 +609,8 @@ namespace Shared { } // Get user-specified font path - string zetaglest_font = safeCharPtrCopy(getenv("ZETAGLEST_FONT"), 8095); - string zetaglest_font_family = safeCharPtrCopy(getenv("ZETAGLEST_FONT_FAMILY"), 8095); + string zetaglest_font = safeCharPtrCopy(getenv("GAME_FONT"), 8095); + string zetaglest_font_family = safeCharPtrCopy(getenv("GAME_FONT_FAMILY"), 8095); if (zetaglest_font != "" || zetaglest_font_family != "") { if (zetaglest_font != "") { tryFont = zetaglest_font; diff --git a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp index 831240139..2fde3c04d 100644 --- a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp +++ b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp @@ -47,17 +47,17 @@ namespace Shared { TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) { //throw game_runtime_error("FTGL!"); - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",0); - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/arphic/uming.ttc",0); // Chinese - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/arphic/ukai.ttc",0); // Chinese - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/takao/TakaoPGothic.ttf",0); // Japanese - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech? - //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf",0); // Czech? + //setenv("GAME_FONT","/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",0); + //setenv("GAME_FONT","/usr/share/fonts/truetype/arphic/uming.ttc",0); // Chinese + //setenv("GAME_FONT","/usr/share/fonts/truetype/arphic/ukai.ttc",0); // Chinese + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic + //setenv("GAME_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic + //setenv("GAME_FONT","/usr/share/fonts/truetype/takao/TakaoPGothic.ttf",0); // Japanese + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic + //setenv("GAME_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew + //setenv("GAME_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech? + //setenv("GAME_FONT","/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf",0); // Czech? fontFile = findFont(); diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index 11cab8954..e768ed9a5 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -387,8 +387,8 @@ namespace Shared { } // Allows platforms to specify which sound device to use - // using the environment variable: ZETAGLEST_SOUND_DEVICE - char *deviceName = getenv("ZETAGLEST_SOUND_DEVICE"); + // using the environment variable: GAME_SOUND_DEVICE + char *deviceName = getenv("GAME_SOUND_DEVICE"); device = alcOpenDevice(deviceName); if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) {