Update of /cvsroot/plib/plib/src/pui
In directory usw-pr-cvs1:/tmp/cvs-serv23781
Modified Files:
puFont.cxx pu.h
Log Message:
Added puFont::getFloatStringWidth (suggested by John F. Fay)
Index: puFont.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/puFont.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- puFont.cxx 4 Jun 2002 22:03:33 -0000 1.15
+++ puFont.cxx 7 Jul 2002 19:00:48 -0000 1.16
@@ -55,13 +55,13 @@
#endif // #ifdef _PU_USE_GLUT_FONTS
-int puFont::getStringWidth ( const char *str ) const
+float puFont::getFloatStringWidth ( const char *str ) const
{
if ( str == NULL )
- return 0 ;
+ return 0.0f ;
#ifdef _PU_USE_GLUT_FONTS
- if ( glut_font_handle != (GlutFont) 0 )
+ if ( glut_font_handle != NULL )
{
int res = 0 ;
int max_res = 0 ;
@@ -81,7 +81,7 @@
if ( res > max_res ) max_res = res;
- return max_res ;
+ return (float) max_res ;
}
#endif // #ifdef _PU_USE_GLUT_FONTS
@@ -89,7 +89,7 @@
{
float r, l ;
fnt_font_handle -> getBBox ( str, pointsize, slant, &l, &r, NULL, NULL ) ;
- return (int) ( r - l ) ;
+ return ( r - l ) ;
}
return 0 ;
Index: pu.h
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/pu.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- pu.h 7 Jul 2002 18:27:40 -0000 1.110
+++ pu.h 7 Jul 2002 19:00:48 -0000 1.111
@@ -126,7 +126,12 @@
int getStringDescender ( void ) const ;
int getStringHeight ( const char *str ) const ;
int getStringHeight ( void ) const { return getStringHeight ( "K" ) ; }
- int getStringWidth ( const char *str ) const ;
+
+ float getFloatStringWidth ( const char *str ) const ;
+ int getStringWidth ( const char *str ) const /* Deprecated ? */
+ {
+ return (int) getFloatStringWidth ( str ) ;
+ }
void drawString ( const char *str, int x, int y ) ;
} ;
|