mirror of
https://github.com/glest/glest-source.git
synced 2025-08-14 04:13:58 +02:00
- fixed font verticle centering for ftgl
This commit is contained in:
@@ -1953,22 +1953,22 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
|
|||||||
if(lineHeight < h) {
|
if(lineHeight < h) {
|
||||||
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
|
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
|
||||||
|
|
||||||
if(Font::forceFTGLFonts == true) {
|
//if(Font::forceFTGLFonts == true) {
|
||||||
// First go to top of bounding box
|
// First go to top of bounding box
|
||||||
pos.y += (h - lineHeight);
|
pos.y += (h - lineHeight);
|
||||||
pos.y -= ((h - lineHeight) / Font::scaleFontValueCenterHFactor);
|
pos.y -= ((h - lineHeight) / Font::scaleFontValueCenterHFactor);
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
pos.y += (float)(((float)h) / 2.0);
|
// pos.y += (float)(((float)h) / 2.0);
|
||||||
float heightGap = (float)(((float)h - lineHeight) / 2.0);
|
// float heightGap = (float)(((float)h - lineHeight) / 2.0);
|
||||||
pos.y -= heightGap;
|
// pos.y -= heightGap;
|
||||||
|
//
|
||||||
//printf("h = %d lineHeight = %f heightGap = %f\n",h,lineHeight,heightGap);
|
// //printf("h = %d lineHeight = %f heightGap = %f\n",h,lineHeight,heightGap);
|
||||||
|
//
|
||||||
// Now calculate till we get text to middle
|
// // Now calculate till we get text to middle
|
||||||
//pos.y -= (realHeight / 2);
|
// //pos.y -= (realHeight / 2);
|
||||||
//pos.y += (lineHeight / 2);
|
// //pos.y += (lineHeight / 2);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else if(lineHeight > h) {
|
else if(lineHeight > h) {
|
||||||
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
|
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
|
||||||
|
Reference in New Issue
Block a user