- added new commandline option to override base font size

This commit is contained in:
Mark Vejvoda
2011-10-03 02:45:43 +00:00
parent d719e8e318
commit 7eb68c4023
2 changed files with 30 additions and 0 deletions

View File

@@ -2751,6 +2751,30 @@ int glestMain(int argc, char** argv) {
// end win32
#endif
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_FONT_BASESIZE]) == true) {
int foundParamIndIndex = -1;
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_FONT_BASESIZE]) + string("="),&foundParamIndIndex);
if(foundParamIndIndex < 0) {
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_FONT_BASESIZE]),&foundParamIndIndex);
}
string paramValue = argv[foundParamIndIndex];
vector<string> paramPartTokens;
Tokenize(paramValue,paramPartTokens,"=");
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
string newfontBaseSize = paramPartTokens[1];
//printf("#1 Forcing font [%s] paramPartTokens.size() = %d, paramValue [%s]\n",newfont.c_str(),paramPartTokens.size(),paramValue.c_str());
printf("Forcing font base size[%s]\n",newfontBaseSize.c_str());
Font::baseSize = strToInt(newfontBaseSize);
}
else {
printf("\nInvalid missing font base size specified on commandline [%s] value [%s]\n\n",argv[foundParamIndIndex],(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
//printParameterHelp(argv[0],false);
return -1;
}
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet,Font::fontIsMultibyte,Font::fontIsRightToLeft);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet,Font::fontIsMultibyte,Font::fontIsRightToLeft);

View File

@@ -61,6 +61,7 @@ const char *GAME_ARGS[] = {
//"--windowed",
"--use-font",
"--font-basesize",
"--verbose"
};
@@ -105,6 +106,7 @@ enum GAME_ARG_TYPE {
GAME_ARG_USE_FULLSCREEN,
GAME_ARG_USE_FONT,
GAME_ARG_FONT_BASESIZE,
GAME_ARG_VERBOSE_MODE
};
@@ -236,6 +238,10 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n \t\tWhere x is the path and name of a font file support by freetype2.");
printf("\n \t\texample: %s %s=$APPLICATIONDATAPATH/data/core/fonts/Vera.ttf",argv0,GAME_ARGS[GAME_ARG_USE_FONT]);
printf("\n%s=x\t\t\toverride the font base size.",GAME_ARGS[GAME_ARG_FONT_BASESIZE]);
printf("\n \t\tWhere x is the numeric base font size to use.");
printf("\n \t\texample: %s %s=5",argv0,GAME_ARGS[GAME_ARG_FONT_BASESIZE]);
printf("\n%s\t\t\tdisplays verbose information in the console.",GAME_ARGS[GAME_ARG_VERBOSE_MODE]);
printf("\n\n");