From f5d5d865a8cc93453d346c899432b9f83f04fa82 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Tue, 22 Nov 2022 11:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'3rdparty/fonts/fnt.cxx'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdparty/fonts/fnt.cxx | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/3rdparty/fonts/fnt.cxx b/3rdparty/fonts/fnt.cxx index 560b68d..9a1a4bd 100644 --- a/3rdparty/fonts/fnt.cxx +++ b/3rdparty/fonts/fnt.cxx @@ -48,6 +48,38 @@ float fntTexFont::low_putch ( sgVec3 curpos, float pointsize, /* 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 if ( ! exists [ cc ] ) { @@ -60,6 +92,9 @@ float fntTexFont::low_putch ( sgVec3 curpos, float pointsize, if ( cc >= 'a' && cc <= 'z' ) cc = cc - 'a' + 'A' ; */ + + SG_LOG(SG_GUI,SG_ALERT, "未找到字符"); + if ( cc == ' ' ) { curpos [ 0 ] += pointsize / 2.0f ; @@ -181,11 +216,10 @@ void fntTexFont::getBBox ( const char *s, continue ; } -// unsigned int cc = (unsigned char) *(s++) ; unsigned int cc = (unsigned char) *(s++) ; 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) { @@ -211,7 +245,7 @@ void fntTexFont::getBBox ( const char *s, 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 ] ) { SG_LOG(SG_GUI,SG_ALERT, "未找到字符"); continue ; - } if ( italic >= 0 )