fixed legacyfont

This commit is contained in:
Mark Vejvoda 2011-11-01 23:51:28 +00:00
parent bb25e0ec79
commit 3dfd316484
4 changed files with 15 additions and 8 deletions

View File

@ -2571,7 +2571,8 @@ int glestMain(int argc, char** argv) {
if(config.getBool("EnableLegacyFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]) == true) {
Font::forceLegacyFonts = true;
Renderer::renderText3DEnabled = false;
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Forcing Legacy Fonts Enabled\n");
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Forcing Legacy Fonts Enabled\n");
printf("**WARNING** Forcing Legacy Fonts Enabled\n");
}
else {
Renderer::renderText3DEnabled = config.getBool("Enable3DFontRendering",intToStr(Renderer::renderText3DEnabled).c_str());

View File

@ -56,7 +56,7 @@ void Font::resetToDefaults() {
Font::charCount = 256;
Font::fontTypeName = "Times New Roman";
Font::fontIsMultibyte = false;
Font::forceLegacyFonts = false;
//Font::forceLegacyFonts = false;
Font::fontIsRightToLeft = false;
// This value is used to scale the font text rendering

View File

@ -26,12 +26,15 @@ using namespace Platform;
string FontGl::default_fonttype = "fixed";
void Font2DGl::init() {
//printf("In [%s::%s] Line: %d inited = %d\n",__FILE__,__FUNCTION__,__LINE__,inited);
if(inited == false) {
if(getTextHandler() == NULL) {
//printf("In [%s::%s] Line: %d inited = %d Font::forceLegacyFonts = %d\n",__FILE__,__FUNCTION__,__LINE__,inited,Font::forceLegacyFonts);
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
assertGl();
handle= glGenLists(charCount);
assertGl();
//printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
createGlFontBitmaps((Shared::Platform::uint32&)handle, type, size, width, charCount, metrics);
assertGl();
}
@ -41,7 +44,7 @@ void Font2DGl::init() {
void Font2DGl::end() {
if(inited) {
if(getTextHandler() == NULL) {
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
assertGl();
//assert(glIsList(handle));
glDeleteLists(handle, 1);
@ -56,8 +59,9 @@ void Font2DGl::end() {
// =====================================================
void Font3DGl::init() {
//printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
if(inited == false) {
if(getTextHandler() == NULL) {
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
assertGl();
handle= glGenLists(charCount);
createGlFontOutlines((Shared::Platform::uint32&)handle, type, width, depth, charCount, metrics);
@ -69,7 +73,7 @@ void Font3DGl::init() {
void Font3DGl::end() {
if(inited) {
if(getTextHandler() == NULL) {
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
assertGl();
assert(glIsList(handle));
glDeleteLists(handle, 1);

View File

@ -41,7 +41,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("About to try font [%s]\n",type.c_str());
printf("About to try font [%s]\n",type.c_str());
//printf("About to try font [%s]\n",type.c_str());
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
if(fontInfo == NULL) {
@ -49,7 +49,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
//throw std::runtime_error("Font not found: [" + type + "]");
SystemFlags::OutputDebug(SystemFlags::debugError,"Font not found [%s] trying to fallback to [%s]\n",type.c_str(),default_font.c_str());
printf("Font not found [%s] trying to fallback to [%s]\n",type.c_str(),default_font.c_str());
//printf("Font not found [%s] trying to fallback to [%s]\n",type.c_str(),default_font.c_str());
fontInfo = XLoadQueryFont(display, default_font.c_str());
if(fontInfo == NULL) {
@ -58,6 +58,8 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
}
// we need the height of 'a' which sould ~ be half ascent+descent
//printf("Font height [%s] = %d\n",type.c_str(),(fontInfo->ascent + fontInfo->descent) / 2);
metrics.setHeight(static_cast<float>
(fontInfo->ascent + fontInfo->descent) / 2);