mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 21:51:17 +02:00
Added more debug output and protection for X11 font processing
This commit is contained in:
@@ -100,23 +100,32 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
|||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// we need the height of 'a' which sould ~ be half ascent+descent
|
// we need the height of 'a' which sould ~ be half ascent+descent
|
||||||
metrics.setHeight(static_cast<float>
|
float height = (static_cast<float>(fontInfo->ascent + fontInfo->descent) / 2);
|
||||||
(fontInfo->ascent + fontInfo->descent) / 2);
|
if(height <= 0) {
|
||||||
|
height = static_cast<float>(6);
|
||||||
|
}
|
||||||
|
metrics.setHeight(height);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] height = %f\n",__FILE__,__FUNCTION__,__LINE__,height);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < static_cast<unsigned int> (charCount); ++i) {
|
for(unsigned int i = 0; i < static_cast<unsigned int> (charCount); ++i) {
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(i < fontInfo->min_char_or_byte2 ||
|
if(i < fontInfo->min_char_or_byte2 || i > fontInfo->max_char_or_byte2) {
|
||||||
i > fontInfo->max_char_or_byte2) {
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
float width = static_cast<float>(6);
|
||||||
metrics.setWidth(i, static_cast<float>(6));
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] setting size = %f\n",__FILE__,__FUNCTION__,__LINE__,width);
|
||||||
|
|
||||||
|
metrics.setWidth(i, width);
|
||||||
} else {
|
} else {
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
int p = i - fontInfo->min_char_or_byte2;
|
int p = i - fontInfo->min_char_or_byte2;
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,p,fontInfo->per_char);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,p,fontInfo->per_char);
|
||||||
|
|
||||||
if(fontInfo->per_char == NULL) {
|
if(fontInfo->per_char == NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),p,fontInfo->per_char);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),p,fontInfo->per_char);
|
||||||
|
|
||||||
@@ -126,29 +135,41 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
|||||||
//int spanLength = (charWidth + 7) / 8;
|
//int spanLength = (charWidth + 7) / 8;
|
||||||
|
|
||||||
if(charinfo != NULL) {
|
if(charinfo != NULL) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] charinfo->width = %d\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),charinfo->width);
|
||||||
metrics.setWidth(i, static_cast<float> (charinfo->width));
|
metrics.setWidth(i, static_cast<float> (charinfo->width));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size 6\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
|
||||||
|
|
||||||
metrics.setWidth(i, static_cast<float>(6));
|
metrics.setWidth(i, static_cast<float>(6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
metrics.setWidth(i, static_cast<float> (
|
float width = static_cast<float> (fontInfo->per_char[p].rbearing - fontInfo->per_char[p].lbearing);
|
||||||
fontInfo->per_char[p].rbearing
|
if(width <= 0) {
|
||||||
- fontInfo->per_char[p].lbearing));
|
width = static_cast<float>(6);
|
||||||
|
}
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size = %f\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),width);
|
||||||
|
metrics.setWidth(i, width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
GLenum glerror = ::glGetError();
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] glerror = %d\n",__FILE__,__FUNCTION__,__LINE__,glerror);
|
||||||
|
|
||||||
|
|
||||||
XFreeFont(display, fontInfo);
|
XFreeFont(display, fontInfo);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
#else
|
#else
|
||||||
// we badly need a solution portable to more than just glx
|
// we badly need a solution portable to more than just glx
|
||||||
//NOIMPL;
|
//NOIMPL;
|
||||||
|
Reference in New Issue
Block a user