1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 01:06:41 +00:00

Fix russian font display & font size calculation (my bad, thx Henrik)

This commit is contained in:
fgenesis 2012-07-13 16:03:21 +02:00
parent 319b9d09ed
commit aeb96ca2dd
2 changed files with 9 additions and 10 deletions

View file

@ -195,7 +195,7 @@ int GLFont::GetEndChar (void)
return header.end_char;
}
//*******************************************************************
void GLFont::GetCharSize (unsigned int c, std::pair<int, int> *size)
void GLFont::GetCharSize (unsigned char c, std::pair<int, int> *size)
{
//Make sure character is in range
if (c < header.start_char || c > header.end_char)
@ -216,7 +216,7 @@ void GLFont::GetCharSize (unsigned int c, std::pair<int, int> *size)
}
}
//*******************************************************************
int GLFont::GetCharWidth (unsigned int c)
int GLFont::GetCharWidth (unsigned char c)
{
//Make sure in range
if (c < header.start_char || c > header.end_char)
@ -240,7 +240,7 @@ int GLFont::GetCharWidth (unsigned int c)
}
}
//*******************************************************************
int GLFont::GetCharHeight (unsigned int c)
int GLFont::GetCharHeight (unsigned char c)
{
//Make sure in range
if (c < header.start_char || c > header.end_char)
@ -266,7 +266,7 @@ void GLFont::Begin (void)
void GLFont::GetStringSize (const std::string &text, std::pair<int, int> *size)
{
unsigned int i;
unsigned char c;
unsigned int c;
GLFontChar *glfont_char;
float width;

View file

@ -70,9 +70,9 @@ public:
int GetEndChar (void);
//Character size retrieval methods
void GetCharSize (unsigned int c, std::pair<int, int> *size);
int GetCharWidth (unsigned int c);
int GetCharHeight (unsigned int c);
void GetCharSize (unsigned char c, std::pair<int, int> *size);
int GetCharWidth (unsigned char c);
int GetCharHeight (unsigned char c);
void GetStringSize (const std::string &text, std::pair<int, int> *size);
@ -86,21 +86,20 @@ public:
float y, const float *top_color, const float *bottom_color, float alpha, float lastAlpha)
{
unsigned int i;
T c;
GLFontChar *glfont_char;
float width, height;
//Begin rendering quads
glBegin(GL_QUADS);
int sz = text.size();
unsigned int sz = text.size();
float a = 0;
//Loop through characters
for (i = 0; i < sz; i++)
{
//Make sure character is in range
c = text[i];
unsigned int c = (unsigned char)text[i];
if (c < header.start_char || c > header.end_char)
continue;