From 0619a2677e44f04d8639774324bf58a99595e11f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 20 Sep 2010 23:00:27 +0000 Subject: [PATCH] - Fixed: SBarInfo couldn't print extended ASCII characters. SVN r2838 (trunk) --- src/g_shared/sbarinfo.cpp | 12 ++++++------ src/g_shared/sbarinfo_commands.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index eed9d86c79..8b97c7cf3c 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1352,16 +1352,16 @@ public: if(script->spacingCharacter == '\0') ax += font->GetSpaceWidth(); else - ax += font->GetCharWidth((int) script->spacingCharacter); + ax += font->GetCharWidth((unsigned char) script->spacingCharacter); str++; continue; } int width; if(script->spacingCharacter == '\0') //No monospace? - width = font->GetCharWidth((int) *str); + width = font->GetCharWidth((unsigned char) *str); else - width = font->GetCharWidth((int) script->spacingCharacter); - FTexture* character = font->GetChar((int) *str, &width); + width = font->GetCharWidth((unsigned char) script->spacingCharacter); + FTexture* character = font->GetChar((unsigned char) *str, &width); if(character == NULL) //missing character. { str++; @@ -1378,7 +1378,7 @@ public: if(script->spacingCharacter != '\0') { - double spacingSize = font->GetCharWidth((int) script->spacingCharacter); + double spacingSize = font->GetCharWidth((unsigned char) script->spacingCharacter); switch(script->spacingAlignment) { default: @@ -1444,7 +1444,7 @@ public: if(script->spacingCharacter == '\0') ax += width + spacing - (character->LeftOffset+1); else //width gets changed at the call to GetChar() - ax += font->GetCharWidth((int) script->spacingCharacter) + spacing; + ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing; str++; } } diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index e66d23f79e..3536bfa5e7 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -745,13 +745,13 @@ class CommandDrawString : public SBarInfoCommand if(script->spacingCharacter == '\0') x -= static_cast (font->StringWidth(str)+(spacing * str.Len())); else //monospaced, so just multiplay the character size - x -= static_cast ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len()); + x -= static_cast ((font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing) * str.Len()); break; case ALIGN_CENTER: if(script->spacingCharacter == '\0') x -= static_cast (font->StringWidth(str)+(spacing * str.Len()) / 2); else - x -= static_cast ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len() / 2); + x -= static_cast ((font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing) * str.Len() / 2); break; } }