- Fixed: SBarInfo couldn't print extended ASCII characters.

SVN r2838 (trunk)
This commit is contained in:
Braden Obrzut 2010-09-20 23:00:27 +00:00
parent 59b19d36fb
commit 0619a2677e
2 changed files with 8 additions and 8 deletions

View file

@ -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++;
}
}

View file

@ -745,13 +745,13 @@ class CommandDrawString : public SBarInfoCommand
if(script->spacingCharacter == '\0')
x -= static_cast<int> (font->StringWidth(str)+(spacing * str.Len()));
else //monospaced, so just multiplay the character size
x -= static_cast<int> ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len());
x -= static_cast<int> ((font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing) * str.Len());
break;
case ALIGN_CENTER:
if(script->spacingCharacter == '\0')
x -= static_cast<int> (font->StringWidth(str)+(spacing * str.Len()) / 2);
else
x -= static_cast<int> ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len() / 2);
x -= static_cast<int> ((font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing) * str.Len() / 2);
break;
}
}