mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-07 15:31:02 +00:00
- fixed the status bar string drawers which weren't UTF-8 capable yet.
This commit is contained in:
parent
c5156d4598
commit
bae0094039
2 changed files with 15 additions and 18 deletions
|
@ -1356,20 +1356,20 @@ public:
|
||||||
{
|
{
|
||||||
Scale = { 1.,1. };
|
Scale = { 1.,1. };
|
||||||
}
|
}
|
||||||
while(*str != '\0')
|
int ch;
|
||||||
|
while (ch = GetCharFromString(str), ch != '\0')
|
||||||
{
|
{
|
||||||
if(*str == ' ')
|
if(ch == ' ')
|
||||||
{
|
{
|
||||||
if(script->spacingCharacter == '\0')
|
if(script->spacingCharacter == '\0')
|
||||||
ax += font->GetSpaceWidth();
|
ax += font->GetSpaceWidth();
|
||||||
else
|
else
|
||||||
ax += font->GetCharWidth((unsigned char) script->spacingCharacter);
|
ax += font->GetCharWidth((unsigned char) script->spacingCharacter);
|
||||||
str++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(*str == TEXTCOLOR_ESCAPE)
|
else if(ch == TEXTCOLOR_ESCAPE)
|
||||||
{
|
{
|
||||||
EColorRange newColor = V_ParseFontColor(++str, translation, boldTranslation);
|
EColorRange newColor = V_ParseFontColor(str, translation, boldTranslation);
|
||||||
if(newColor != CR_UNDEFINED)
|
if(newColor != CR_UNDEFINED)
|
||||||
fontcolor = newColor;
|
fontcolor = newColor;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1377,17 +1377,15 @@ public:
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
if(script->spacingCharacter == '\0') //No monospace?
|
if(script->spacingCharacter == '\0') //No monospace?
|
||||||
width = font->GetCharWidth((unsigned char) *str);
|
width = font->GetCharWidth(ch);
|
||||||
else
|
else
|
||||||
width = font->GetCharWidth((unsigned char) script->spacingCharacter);
|
width = font->GetCharWidth((unsigned char) script->spacingCharacter);
|
||||||
bool redirected = false;
|
bool redirected = false;
|
||||||
FTexture* c = font->GetChar((unsigned char) *str, fontcolor, &width);
|
FTexture* c = font->GetChar(ch, fontcolor, &width);
|
||||||
if(c == NULL) //missing character.
|
if(c == NULL) //missing character.
|
||||||
{
|
{
|
||||||
str++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int character = (unsigned char)*str;
|
|
||||||
|
|
||||||
if (script->spacingCharacter == '\0') //If we are monospaced lets use the offset
|
if (script->spacingCharacter == '\0') //If we are monospaced lets use the offset
|
||||||
ax += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size
|
ax += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size
|
||||||
|
@ -1441,14 +1439,14 @@ public:
|
||||||
double salpha = (Alpha *HR_SHADOW);
|
double salpha = (Alpha *HR_SHADOW);
|
||||||
double srx = rx + (shadowX*Scale.X);
|
double srx = rx + (shadowX*Scale.X);
|
||||||
double sry = ry + (shadowY*Scale.Y);
|
double sry = ry + (shadowY*Scale.Y);
|
||||||
screen->DrawChar(font, CR_UNTRANSLATED, srx, sry, character,
|
screen->DrawChar(font, CR_UNTRANSLATED, srx, sry, ch,
|
||||||
DTA_DestWidthF, rw,
|
DTA_DestWidthF, rw,
|
||||||
DTA_DestHeightF, rh,
|
DTA_DestHeightF, rh,
|
||||||
DTA_Alpha, salpha,
|
DTA_Alpha, salpha,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
screen->DrawChar(font, fontcolor, rx, ry, character,
|
screen->DrawChar(font, fontcolor, rx, ry, ch,
|
||||||
DTA_DestWidthF, rw,
|
DTA_DestWidthF, rw,
|
||||||
DTA_DestHeightF, rh,
|
DTA_DestHeightF, rh,
|
||||||
DTA_Alpha, Alpha,
|
DTA_Alpha, Alpha,
|
||||||
|
@ -1457,7 +1455,6 @@ public:
|
||||||
ax += width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
ax += width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
||||||
else //width gets changed at the call to GetChar()
|
else //width gets changed at the call to GetChar()
|
||||||
ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing;
|
ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing;
|
||||||
str++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1481,15 +1481,15 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
||||||
break;
|
break;
|
||||||
case DI_TEXT_ALIGN_RIGHT:
|
case DI_TEXT_ALIGN_RIGHT:
|
||||||
if (!monospaced)
|
if (!monospaced)
|
||||||
x -= static_cast<int> (font->StringWidth(cstring) + (spacing * cstring.Len()));
|
x -= static_cast<int> (font->StringWidth(cstring) + (spacing * cstring.CharacterCount()));
|
||||||
else //monospaced, so just multiply the character size
|
else //monospaced, so just multiply the character size
|
||||||
x -= static_cast<int> ((spacing) * cstring.Len());
|
x -= static_cast<int> ((spacing) * cstring.CharacterCount());
|
||||||
break;
|
break;
|
||||||
case DI_TEXT_ALIGN_CENTER:
|
case DI_TEXT_ALIGN_CENTER:
|
||||||
if (!monospaced)
|
if (!monospaced)
|
||||||
x -= static_cast<int> (font->StringWidth(cstring) + (spacing * cstring.Len())) / 2;
|
x -= static_cast<int> (font->StringWidth(cstring) + (spacing * cstring.CharacterCount())) / 2;
|
||||||
else //monospaced, so just multiply the character size
|
else //monospaced, so just multiply the character size
|
||||||
x -= static_cast<int> ((spacing)* cstring.Len()) / 2;
|
x -= static_cast<int> ((spacing)* cstring.CharacterCount()) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1527,7 +1527,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
||||||
Scale = { 1.,1. };
|
Scale = { 1.,1. };
|
||||||
}
|
}
|
||||||
int ch;
|
int ch;
|
||||||
while (ch = *str++, ch != '\0')
|
while (ch = GetCharFromString(str), ch != '\0')
|
||||||
{
|
{
|
||||||
if (ch == ' ')
|
if (ch == ' ')
|
||||||
{
|
{
|
||||||
|
@ -1543,7 +1543,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
||||||
}
|
}
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
FTexture* c = font->GetChar((unsigned char)ch, fontcolor, &width);
|
FTexture* c = font->GetChar(ch, fontcolor, &width);
|
||||||
if (c == NULL) //missing character.
|
if (c == NULL) //missing character.
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue