更新 '3rdparty/fonts/fnt.cxx'

This commit is contained in:
zhongjin 2022-11-22 11:55:24 +08:00
parent df052d400c
commit f5d5d865a8

View File

@ -48,6 +48,38 @@ float fntTexFont::low_putch ( sgVec3 curpos, float pointsize,
/* Auto case-convert if character is absent from font. */ /* Auto case-convert if character is absent from font. */
if ((cc & 0x80)==0) {
SG_LOG(SG_GUI,SG_ALERT, "ASSIC cc=" << cc);
}
if ( (cc & 0XE0) == 0XE0) {
int x = (cc & 0X0F) << 4;
//SG_LOG(SG_GUI,SG_ALERT, "UTF8 cc<<4 " << x);
cc = (unsigned char) *(s++) ;
//SG_LOG(SG_GUI,SG_ALERT, "UTF81 cc=" << cc);
x= x + ((cc & 0x3C) >>2 ) ;
int y = (cc & 0x03) << 6 ;
cc = (unsigned char) *(s++) ;
//SG_LOG(SG_GUI,SG_ALERT, "UTF82 cc=" << cc);
y= y + (cc & 0x3F);
//SG_LOG(SG_GUI,SG_ALERT, "x=" << x << ",y=" << y);
cc = x * 256 + y;
SG_LOG(SG_GUI,SG_ALERT, "UTF8 cc=" << cc);
}
//zhongjin //zhongjin
if ( ! exists [ cc ] ) if ( ! exists [ cc ] )
{ {
@ -60,6 +92,9 @@ float fntTexFont::low_putch ( sgVec3 curpos, float pointsize,
if ( cc >= 'a' && cc <= 'z' ) if ( cc >= 'a' && cc <= 'z' )
cc = cc - 'a' + 'A' ; cc = cc - 'a' + 'A' ;
*/ */
SG_LOG(SG_GUI,SG_ALERT, "未找到字符");
if ( cc == ' ' ) if ( cc == ' ' )
{ {
curpos [ 0 ] += pointsize / 2.0f ; curpos [ 0 ] += pointsize / 2.0f ;
@ -181,11 +216,10 @@ void fntTexFont::getBBox ( const char *s,
continue ; continue ;
} }
// unsigned int cc = (unsigned char) *(s++) ;
unsigned int cc = (unsigned char) *(s++) ; unsigned int cc = (unsigned char) *(s++) ;
if ((cc & 0x80)==0) { if ((cc & 0x80)==0) {
SG_LOG(SG_GUI,SG_ALERT, "ASSIC cc=" << cc); //SG_LOG(SG_GUI,SG_ALERT, "ASSIC cc=" << cc);
} }
if ( (cc & 0XE0) == 0XE0) { if ( (cc & 0XE0) == 0XE0) {
@ -211,7 +245,7 @@ void fntTexFont::getBBox ( const char *s,
cc = x * 256 + y; cc = x * 256 + y;
SG_LOG(SG_GUI,SG_ALERT, "UTF8 cc=" << cc); //SG_LOG(SG_GUI,SG_ALERT, "UTF8 cc=" << cc);
} }
@ -236,7 +270,6 @@ void fntTexFont::getBBox ( const char *s,
if ( ! exists [ cc ] ) { if ( ! exists [ cc ] ) {
SG_LOG(SG_GUI,SG_ALERT, "未找到字符"); SG_LOG(SG_GUI,SG_ALERT, "未找到字符");
continue ; continue ;
} }
if ( italic >= 0 ) if ( italic >= 0 )