- font ycenter fix on windows

This commit is contained in:
Mark Vejvoda 2011-07-04 21:22:53 +00:00
parent 852b4aa2d2
commit ece9755dfd
1 changed files with 16 additions and 4 deletions

View File

@ -237,6 +237,9 @@ float TextFTGL::LineHeight(const char* str, const int len) {
if(result == -1000) { if(result == -1000) {
FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str()); FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str());
result = box.Upper().Y()- box.Lower().Y(); result = box.Upper().Y()- box.Lower().Y();
if(result == 0) {
result = ftFont->LineHeight();
}
//printf("ftFont->BBox(''yW'')%f\n",result); //printf("ftFont->BBox(''yW'')%f\n",result);
} }
return result; return result;
@ -268,6 +271,19 @@ float TextFTGL::LineHeight(const char* str, const int len) {
} }
float TextFTGL::LineHeight(const wchar_t* str, const int len) {
static float result = -1000;
if(result == -1000) {
FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str());
result = box.Upper().Y()- box.Lower().Y();
if(result == 0) {
result = ftFont->LineHeight();
}
//printf("ftFont->BBox(''yW'')%f\n",result);
}
return result;
}
void TextFTGL::Render(const wchar_t* str, const int len) { void TextFTGL::Render(const wchar_t* str, const int len) {
/* /*
FTGL renders the whole string when len == 0 FTGL renders the whole string when len == 0
@ -282,10 +298,6 @@ float TextFTGL::Advance(const wchar_t* str, const int len) {
return ftFont->Advance(str, len); return ftFont->Advance(str, len);
} }
float TextFTGL::LineHeight(const wchar_t* str, const int len) {
return ftFont->LineHeight();
}
const char* TextFTGL::findFont(const char *firstFontToTry) { const char* TextFTGL::findFont(const char *firstFontToTry) {
const char* font = NULL; const char* font = NULL;
const char* path = NULL; const char* path = NULL;