- 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') if(script->spacingCharacter == '\0')
ax += font->GetSpaceWidth(); ax += font->GetSpaceWidth();
else else
ax += font->GetCharWidth((int) script->spacingCharacter); ax += font->GetCharWidth((unsigned char) script->spacingCharacter);
str++; str++;
continue; continue;
} }
int width; int width;
if(script->spacingCharacter == '\0') //No monospace? if(script->spacingCharacter == '\0') //No monospace?
width = font->GetCharWidth((int) *str); width = font->GetCharWidth((unsigned char) *str);
else else
width = font->GetCharWidth((int) script->spacingCharacter); width = font->GetCharWidth((unsigned char) script->spacingCharacter);
FTexture* character = font->GetChar((int) *str, &width); FTexture* character = font->GetChar((unsigned char) *str, &width);
if(character == NULL) //missing character. if(character == NULL) //missing character.
{ {
str++; str++;
@ -1378,7 +1378,7 @@ public:
if(script->spacingCharacter != '\0') if(script->spacingCharacter != '\0')
{ {
double spacingSize = font->GetCharWidth((int) script->spacingCharacter); double spacingSize = font->GetCharWidth((unsigned char) script->spacingCharacter);
switch(script->spacingAlignment) switch(script->spacingAlignment)
{ {
default: default:
@ -1444,7 +1444,7 @@ public:
if(script->spacingCharacter == '\0') if(script->spacingCharacter == '\0')
ax += width + spacing - (character->LeftOffset+1); ax += width + spacing - (character->LeftOffset+1);
else //width gets changed at the call to GetChar() 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++; str++;
} }
} }

View file

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