fixed legacyfont
This commit is contained in:
parent
bb25e0ec79
commit
3dfd316484
|
@ -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) {
|
if(config.getBool("EnableLegacyFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]) == true) {
|
||||||
Font::forceLegacyFonts = true;
|
Font::forceLegacyFonts = true;
|
||||||
Renderer::renderText3DEnabled = false;
|
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 {
|
else {
|
||||||
Renderer::renderText3DEnabled = config.getBool("Enable3DFontRendering",intToStr(Renderer::renderText3DEnabled).c_str());
|
Renderer::renderText3DEnabled = config.getBool("Enable3DFontRendering",intToStr(Renderer::renderText3DEnabled).c_str());
|
||||||
|
|
|
@ -56,7 +56,7 @@ void Font::resetToDefaults() {
|
||||||
Font::charCount = 256;
|
Font::charCount = 256;
|
||||||
Font::fontTypeName = "Times New Roman";
|
Font::fontTypeName = "Times New Roman";
|
||||||
Font::fontIsMultibyte = false;
|
Font::fontIsMultibyte = false;
|
||||||
Font::forceLegacyFonts = false;
|
//Font::forceLegacyFonts = false;
|
||||||
Font::fontIsRightToLeft = false;
|
Font::fontIsRightToLeft = false;
|
||||||
|
|
||||||
// This value is used to scale the font text rendering
|
// This value is used to scale the font text rendering
|
||||||
|
|
|
@ -26,12 +26,15 @@ using namespace Platform;
|
||||||
string FontGl::default_fonttype = "fixed";
|
string FontGl::default_fonttype = "fixed";
|
||||||
|
|
||||||
void Font2DGl::init() {
|
void Font2DGl::init() {
|
||||||
|
//printf("In [%s::%s] Line: %d inited = %d\n",__FILE__,__FUNCTION__,__LINE__,inited);
|
||||||
if(inited == false) {
|
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();
|
assertGl();
|
||||||
handle= glGenLists(charCount);
|
handle= glGenLists(charCount);
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
|
//printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
createGlFontBitmaps((Shared::Platform::uint32&)handle, type, size, width, charCount, metrics);
|
createGlFontBitmaps((Shared::Platform::uint32&)handle, type, size, width, charCount, metrics);
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +44,7 @@ void Font2DGl::init() {
|
||||||
|
|
||||||
void Font2DGl::end() {
|
void Font2DGl::end() {
|
||||||
if(inited) {
|
if(inited) {
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
|
||||||
assertGl();
|
assertGl();
|
||||||
//assert(glIsList(handle));
|
//assert(glIsList(handle));
|
||||||
glDeleteLists(handle, 1);
|
glDeleteLists(handle, 1);
|
||||||
|
@ -56,8 +59,9 @@ void Font2DGl::end() {
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
void Font3DGl::init() {
|
void Font3DGl::init() {
|
||||||
|
//printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
if(inited == false) {
|
if(inited == false) {
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
|
||||||
assertGl();
|
assertGl();
|
||||||
handle= glGenLists(charCount);
|
handle= glGenLists(charCount);
|
||||||
createGlFontOutlines((Shared::Platform::uint32&)handle, type, width, depth, charCount, metrics);
|
createGlFontOutlines((Shared::Platform::uint32&)handle, type, width, depth, charCount, metrics);
|
||||||
|
@ -69,7 +73,7 @@ void Font3DGl::init() {
|
||||||
|
|
||||||
void Font3DGl::end() {
|
void Font3DGl::end() {
|
||||||
if(inited) {
|
if(inited) {
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL || Font::forceLegacyFonts == true) {
|
||||||
assertGl();
|
assertGl();
|
||||||
assert(glIsList(handle));
|
assert(glIsList(handle));
|
||||||
glDeleteLists(handle, 1);
|
glDeleteLists(handle, 1);
|
||||||
|
|
|
@ -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());
|
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());
|
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
|
||||||
if(fontInfo == NULL) {
|
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 + "]");
|
//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());
|
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());
|
fontInfo = XLoadQueryFont(display, default_font.c_str());
|
||||||
if(fontInfo == NULL) {
|
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
|
// 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>
|
metrics.setHeight(static_cast<float>
|
||||||
(fontInfo->ascent + fontInfo->descent) / 2);
|
(fontInfo->ascent + fontInfo->descent) / 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user