From ecf4baa0a231ba429b0e64f10b481c89426e1805 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Mon, 21 Nov 2022 23:39:46 +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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/3rdparty/fonts/fnt.cxx b/3rdparty/fonts/fnt.cxx index 50e619e..f340e28 100644 --- a/3rdparty/fonts/fnt.cxx +++ b/3rdparty/fonts/fnt.cxx @@ -168,6 +168,7 @@ void fntTexFont::getBBox ( const char *s, //zhongjin SG_LOG(SG_GUI,SG_ALERT, "getBBox " << s); + l = r = b = t = 0.0f ; while ( *s != '\0' ) @@ -180,16 +181,21 @@ void fntTexFont::getBBox ( const char *s, continue ; } - unsigned int cc = (unsigned char) *(s++) ; +// unsigned int cc = (unsigned char) *(s++) ; + unsigned int cc = (unsigned int) *(s++) ; + + SG_LOG(SG_GUI,SG_ALERT, "cc=" << cc); + if ( ! exists [ cc ] ) { + /* if ( cc >= 'A' && cc <= 'Z' ) cc = cc - 'A' + 'a' ; else if ( cc >= 'a' && cc <= 'z' ) cc = cc - 'a' + 'A' ; - + */ if ( cc == ' ' ) { r += 0.5f ; @@ -220,6 +226,10 @@ void fntTexFont::getBBox ( const char *s, h_pos += gap + ( fixed_pitch ? width : widths[cc] ) ; } + //zhongjin + SG_LOG(SG_GUI,SG_ALERT, "......................"); + + if ( left != NULL ) *left = l * pointsize ; if ( right != NULL ) *right = r * pointsize ; if ( top != NULL ) *top = t * pointsize ;