no fun with fonts
This commit is contained in:
parent
4e4825d752
commit
baea45cae8
|
@ -344,6 +344,9 @@ int CoreData::computeFontSize(int size) {
|
||||||
}
|
}
|
||||||
//FontSizeAdjustment
|
//FontSizeAdjustment
|
||||||
rs += config.getInt("FontSizeAdjustment");
|
rs += config.getInt("FontSizeAdjustment");
|
||||||
|
if(Font::forceLegacyFonts == false) {
|
||||||
|
rs += Font::baseSize; //basesize only for new font system
|
||||||
|
}
|
||||||
if(Font::forceLegacyFonts == true) {
|
if(Font::forceLegacyFonts == true) {
|
||||||
if(rs < 10) {
|
if(rs < 10) {
|
||||||
rs= 10;
|
rs= 10;
|
||||||
|
|
|
@ -1445,20 +1445,25 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
|
||||||
pos.x += ((w / 2.f) - (lineWidth / 2.f));
|
pos.x += ((w / 2.f) - (lineWidth / 2.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
//h /= 2.f;
|
|
||||||
float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue);
|
float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue);
|
||||||
if(lineHeight < h) {
|
lineHeight= lineHeight / (2.f + 0.2f * FontMetrics::DEFAULT_Y_OFFSET_FACTOR);
|
||||||
//pos.y += ((float)h / 2.f);
|
pos.y += (h / 2.f) - (lineHeight / 2.f);
|
||||||
//pos.y -= ((float(h) / 2.f) - (lineHeight / 2.f));
|
|
||||||
pos.y += (lineHeight / 2.f) + FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
|
// //h /= 2.f;
|
||||||
//pos.y -= h;
|
// float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue);
|
||||||
//printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y);
|
// if(lineHeight < h) {
|
||||||
|
// //pos.y += ((float)h / 2.f);
|
||||||
|
// //pos.y -= ((float(h) / 2.f) - (lineHeight / 2.f));
|
||||||
|
// pos.y += (lineHeight / 2.f) + FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
|
||||||
|
// //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);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// pos.y += ((float)h / 2.f) - FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
|
||||||
|
// }
|
||||||
|
|
||||||
//printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pos.y += ((float)h / 2.f) - FontMetrics::DEFAULT_Y_OFFSET_FACTOR;
|
|
||||||
}
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2559,6 +2559,7 @@ int glestMain(int argc, char** argv) {
|
||||||
Font::fontTypeName = config.getString("FONT_TYPENAME",Font::fontTypeName.c_str());
|
Font::fontTypeName = config.getString("FONT_TYPENAME",Font::fontTypeName.c_str());
|
||||||
Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(Font::fontIsMultibyte).c_str());
|
Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(Font::fontIsMultibyte).c_str());
|
||||||
Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(Font::fontIsRightToLeft).c_str());
|
Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(Font::fontIsRightToLeft).c_str());
|
||||||
|
Font::baseSize = config.getInt("FONT_BASE_SIZE",intToStr(Font::baseSize).c_str());
|
||||||
|
|
||||||
// Example values:
|
// Example values:
|
||||||
// DEFAULT_CHARSET (English) = 1
|
// DEFAULT_CHARSET (English) = 1
|
||||||
|
@ -2648,7 +2649,11 @@ int glestMain(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
lang.loadStrings(language);
|
lang.loadStrings(language);
|
||||||
|
if( lang.hasString("FONT_BASE_SIZE")) {
|
||||||
|
// 256 for English
|
||||||
|
// 30000 for Chinese
|
||||||
|
Font::baseSize = strToInt(lang.get("FONT_BASE_SIZE"));
|
||||||
|
}
|
||||||
if( lang.hasString("FONT_CHARCOUNT")) {
|
if( lang.hasString("FONT_CHARCOUNT")) {
|
||||||
// 256 for English
|
// 256 for English
|
||||||
// 30000 for Chinese
|
// 30000 for Chinese
|
||||||
|
|
|
@ -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 baseSize;
|
||||||
//static int scaleFontYOffset;
|
//static int scaleFontYOffset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -39,6 +39,7 @@ bool Font::forceLegacyFonts = false;
|
||||||
float FontMetrics::DEFAULT_Y_OFFSET_FACTOR = 2.0f;
|
float FontMetrics::DEFAULT_Y_OFFSET_FACTOR = 2.0f;
|
||||||
bool Font::fontIsRightToLeft = false;
|
bool Font::fontIsRightToLeft = false;
|
||||||
float Font::scaleFontValue = 0.75;
|
float Font::scaleFontValue = 0.75;
|
||||||
|
int Font::baseSize = 0;
|
||||||
//int Font::scaleFontYOffset = 0;
|
//int Font::scaleFontYOffset = 0;
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue