- bugfix for y centering of font for different fonts / languages

This commit is contained in:
Mark Vejvoda
2011-06-28 08:15:05 +00:00
parent a9dfd3853b
commit 0e897ee94f
3 changed files with 6 additions and 4 deletions

View File

@@ -1450,14 +1450,14 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
if(lineHeight < h) { if(lineHeight < h) {
//pos.y += ((float)h / 2.f); //pos.y += ((float)h / 2.f);
//pos.y -= ((float(h) / 2.f) - (lineHeight / 2.f)); //pos.y -= ((float(h) / 2.f) - (lineHeight / 2.f));
pos.y += (lineHeight / 2.f) + 2; pos.y += (lineHeight / 2.f) + FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
//pos.y -= h; //pos.y -= h;
//printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y); //printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y);
//printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y); //printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y);
} }
else { else {
pos.y += ((float)h / 2.f) - 2; pos.y += ((float)h / 2.f) - FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
} }
return pos; return pos;
} }

View File

@@ -66,6 +66,7 @@ public:
static bool forceLegacyFonts; static bool forceLegacyFonts;
static bool fontIsRightToLeft; static bool fontIsRightToLeft;
static float scaleFontValue; static float scaleFontValue;
//static int scaleFontYOffset;
public: public:
enum Width { enum Width {

View File

@@ -36,9 +36,10 @@ int Font::charCount = 256;
std::string Font::fontTypeName = "Times New Roman"; std::string Font::fontTypeName = "Times New Roman";
bool Font::fontIsMultibyte = false; bool Font::fontIsMultibyte = false;
bool Font::forceLegacyFonts = false; bool Font::forceLegacyFonts = false;
float FontMetrics::DEFAULT_Y_OFFSET_FACTOR = 8.0f; float FontMetrics::DEFAULT_Y_OFFSET_FACTOR = 0.0f;
bool Font::fontIsRightToLeft = false; bool Font::fontIsRightToLeft = false;
float Font::scaleFontValue = 0.65; float Font::scaleFontValue = 0.75;
//int Font::scaleFontYOffset = 0;
// //
// ===================================================== // =====================================================