diff --git a/Source/Core/VideoBackends/Software/RasterFont.cpp b/Source/Core/VideoBackends/Software/RasterFont.cpp index 7876ac4585..8aefd89599 100644 --- a/Source/Core/VideoBackends/Software/RasterFont.cpp +++ b/Source/Core/VideoBackends/Software/RasterFont.cpp @@ -161,7 +161,7 @@ void RasterFont::printString(const char *s, double x, double y, double z) void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z) { int length = (int)strlen(s); - int x = (int)(screen_width/2.0 - (length/2.0)*char_width); + int x = (int)(screen_width/2.0 - (length/2.0) * CHAR_WIDTH); printString(s, x, y, z); } @@ -177,7 +177,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta { *t = 0; printString(temp, x, y, z); - y -= char_height * 2.0f / bbHeight; + y -= CHAR_HEIGHT * 2.0f / bbHeight; x = start_x; t = temp; } @@ -187,12 +187,12 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta } else if (*text == '\t') { - //todo: add tabs every something like 4*char_width + //todo: add tabs every something like 4 * CHAR_WIDTH *t = 0; int cpos = (int)strlen(temp); int newpos = (cpos + 4) & (~3); printString(temp, x, y, z); - x = start_x + (char_width*newpos) * 2.0f / bbWidth; + x = start_x + (CHAR_WIDTH * newpos) * 2.0f / bbWidth; t = temp; *t++ = ' '; } diff --git a/Source/Core/VideoBackends/Software/RasterFont.h b/Source/Core/VideoBackends/Software/RasterFont.h index 009b5aecc7..e922c4bb3f 100644 --- a/Source/Core/VideoBackends/Software/RasterFont.h +++ b/Source/Core/VideoBackends/Software/RasterFont.h @@ -11,17 +11,17 @@ public: ~RasterFont(void); static int debug; - // some useful constants - enum {char_width = 10}; - enum {char_height = 15}; - // and the happy helper functions void printString(const char *s, double x, double y, double z=0.0); void printCenteredString(const char *s, double y, int screen_width, double z=0.0); void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight); + private: int fontOffset; char *temp_buffer; - enum {TEMP_BUFFER_SIZE = 64 * 1024}; + + static const int TEMP_BUFFER_SIZE = 64 * 1024; + static const int CHAR_WIDTH = 10; + static const int CHAR_HEIGHT = 15; };