- add support for not localizing some text functions, and modify menu text fields to use this
This commit is contained in:
parent
04815f9db4
commit
44d134298a
7 changed files with 48 additions and 35 deletions
|
|
@ -667,9 +667,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
|
|||
ACTION_RETURN_FLOAT(GetBottomAlignOffset(self, code));
|
||||
}
|
||||
|
||||
static int StringWidth(FFont *font, const FString &str)
|
||||
static int StringWidth(FFont *font, const FString &str, bool localize)
|
||||
{
|
||||
const char *txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
|
||||
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||
return font->StringWidth(txt);
|
||||
}
|
||||
|
||||
|
|
@ -677,12 +677,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, StringWidth, StringWidth)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_STRING(str);
|
||||
ACTION_RETURN_INT(StringWidth(self, str));
|
||||
PARAM_BOOL(localize);
|
||||
ACTION_RETURN_INT(StringWidth(self, str, localize));
|
||||
}
|
||||
|
||||
static int GetMaxAscender(FFont* font, const FString& str)
|
||||
static int GetMaxAscender(FFont* font, const FString& str, bool localize)
|
||||
{
|
||||
const char* txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
|
||||
const char* txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||
return font->GetMaxAscender(txt);
|
||||
}
|
||||
|
||||
|
|
@ -690,12 +691,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetMaxAscender, GetMaxAscender)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_STRING(str);
|
||||
ACTION_RETURN_INT(GetMaxAscender(self, str));
|
||||
PARAM_BOOL(localize);
|
||||
ACTION_RETURN_INT(GetMaxAscender(self, str, localize));
|
||||
}
|
||||
|
||||
static int CanPrint(FFont *font, const FString &str)
|
||||
static int CanPrint(FFont *font, const FString &str, bool localize)
|
||||
{
|
||||
const char *txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
|
||||
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||
return font->CanPrint(txt);
|
||||
}
|
||||
|
||||
|
|
@ -703,7 +705,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, CanPrint, CanPrint)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_STRING(str);
|
||||
ACTION_RETURN_INT(CanPrint(self, str));
|
||||
PARAM_BOOL(localize);
|
||||
ACTION_RETURN_INT(CanPrint(self, str, localize));
|
||||
}
|
||||
|
||||
static int FindFontColor(int name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue