Use custom upchar and lochar by default due to accents in font files.

master
Henrique Santiago 12 years ago
parent 26c682c0dc
commit 466d8e8820

@ -131,7 +131,7 @@ locale = {
["Hit Points"] = "Pontos de Vida",
["Hold right mouse button to navigate\nScroll mouse middle button to zoom"] = "Segure o botão direito do mouse para navegar\nRole o botão central do mouse para mudar o zoom",
["Hotkeys"] = "Atalhos",
["If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."] = "Se você desligar o programa o seu personagem pode continuar no jogo.\nClique em 'Sair' para assegurar que seu personagem saia do jogo adequadamente.\nClique em 'Forçar Saida' se voce quer fechar o programa sem desconectar seu personagem.",
["If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."] = "Se você desligar o programa o seu personagem pode continuar no jogo.\nClique em 'Sair' para assegurar que seu personagem saia do jogo adequadamente.\nClique em 'Forçar Saida' para fechar o programa sem desconectar seu personagem.",
["Ignore capacity"] = "Ignorar capacidade",
["Ignore equipped"] = "Ignorar equipado",
["Interface framerate limit: %s"] = "Limite da taxa de quadros da interface: %s",

@ -101,12 +101,12 @@ std::string utf8_to_latin1(uchar *utf8)
void tolower(std::string& str)
{
boost::to_lower(str);
std::transform(str.begin(), str.end(), str.begin(), lochar);
}
void toupper(std::string& str)
{
boost::to_upper(str);
std::transform(str.begin(), str.end(), str.begin(), upchar);
}
void trim(std::string& str)
@ -116,14 +116,16 @@ void trim(std::string& str)
char upchar(char c)
{
#if defined(__GNUC__) && __GNUC__ >= 3
return ::toupper(c); // use the one from global scope "ctype.h"
#else
if((c >= 97 && c <= 122) || (c <= -1 && c >= -32))
if((c >= 97 && c <= 122) || (uchar)c >= 224)
c -= 32;
return c;
}
char lochar(char c)
{
if((c >= 65 && c <= 90) || ((uchar)c >= 192 && (uchar)c <= 223))
c += 32;
return c;
#endif
}
void ucwords(std::string& str)

@ -48,6 +48,7 @@ void toupper(std::string& str);
void trim(std::string& str);
void ucwords(std::string& str);
char upchar(char c);
char lochar(char c);
bool ends_with(const std::string& str, const std::string& test);
bool starts_with(const std::string& str, const std::string& test);
void replace_all(std::string& str, const std::string& search, const std::string& replacement);

@ -108,7 +108,7 @@ void UIWidget::onFontChange(const std::string& font)
void UIWidget::setText(std::string text)
{
if(m_textOnlyUpperCase)
std::transform(text.begin(), text.end(), text.begin(), toupper);
stdext::toupper(text);
if(m_text == text)
return;

Loading…
Cancel
Save