mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
Added more debug output and protection for X11 font processing
This commit is contained in:
parent
092f3a2bca
commit
e3a3b974da
@ -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__);
|
||||
|
||||
// we need the height of 'a' which sould ~ be half ascent+descent
|
||||
metrics.setHeight(static_cast<float>
|
||||
(fontInfo->ascent + fontInfo->descent) / 2);
|
||||
float height = (static_cast<float>(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__);
|
||||
|
||||
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 ||
|
||||
i > fontInfo->max_char_or_byte2) {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
metrics.setWidth(i, static_cast<float>(6));
|
||||
if(i < fontInfo->min_char_or_byte2 || i > fontInfo->max_char_or_byte2) {
|
||||
|
||||
float width = 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 {
|
||||
//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;
|
||||
//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) {
|
||||
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;
|
||||
|
||||
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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
else {
|
||||
metrics.setWidth(i, static_cast<float> (
|
||||
fontInfo->per_char[p].rbearing
|
||||
- fontInfo->per_char[p].lbearing));
|
||||
float width = static_cast<float> (fontInfo->per_char[p].rbearing - fontInfo->per_char[p].lbearing);
|
||||
if(width <= 0) {
|
||||
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__);
|
||||
|
||||
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);
|
||||
|
||||
//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
|
||||
// we badly need a solution portable to more than just glx
|
||||
//NOIMPL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user