[Plib-cvs] CVS: plib/src/pui pu.h,1.96,1.97 puFont.cxx,1.13,1.14 puObject.cxx,1.40,1.41
Brought to you by:
sjbaker
From: Sebastian U. <ud...@us...> - 2002-03-02 18:20:13
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv12662/pui Modified Files: pu.h puFont.cxx puObject.cxx Log Message: Changed calculation of vertically centered legend / label positions Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- pu.h 1 Mar 2002 14:54:44 -0000 1.96 +++ pu.h 2 Mar 2002 18:20:09 -0000 1.97 @@ -120,8 +120,8 @@ } int getStringDescender ( void ) const ; - int getStringHeight ( void ) const ; int getStringHeight ( const char *str ) const ; + int getStringHeight ( void ) const { return getStringHeight ( "K" ) ; } int getStringWidth ( const char *str ) const ; void drawString ( const char *str, int x, int y ) ; Index: puFont.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFont.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- puFont.cxx 2 Mar 2002 17:47:25 -0000 1.13 +++ puFont.cxx 2 Mar 2002 18:20:09 -0000 1.14 @@ -151,12 +151,6 @@ } -int puFont::getStringHeight ( void ) const -{ - return getStringHeight ( "K" ) ; -} - - int puFont::getStringDescender ( void ) const { #ifdef _PU_USE_GLUT_FONTS Index: puObject.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puObject.cxx,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- puObject.cxx 1 Mar 2002 14:54:44 -0000 1.40 +++ puObject.cxx 2 Mar 2002 18:20:09 -0000 1.41 @@ -24,26 +24,6 @@ #include "puLocal.h" -static int count_lines( const char *str ) -{ - int k; // counts lines - - if ( str == NULL ) - k = 0; - else if ( strlen( str ) == 0 ) - k = 0; - else - { - k = 1; // there's at least one line here - while ( *str != '\0' ) - { - if ( *str == '\n' ) k++; // add 1 for each EOL - str++; - } - } - return( k ); -} - inline float clamp01 ( float x ) { return (x >= 1.0f) ? 1.0f : x ; @@ -342,10 +322,9 @@ case PUPLACE_LOWER_LEFT : /* Backwards compatibility to PUPLACE_LEFT */ case PUPLACE_LOWER_RIGHT : /* Backwards compatibility to PUPLACE_RIGHT */ default : - //yy = ( abox.max[1] - abox.min[1] - legendFont.getStringHeight () ) / 2 ; yy = ( abox.max[1] - abox.min[1] + - count_lines( legend ) * legendFont.getStringHeight () ) / 2 - - legendFont.getStringHeight() ; + legendFont.getStringHeight ( legend ) ) / 2 - + legendFont.getStringHeight () ; break ; case PUPLACE_BOTTOM_LEFT : @@ -433,10 +412,9 @@ case PUPLACE_CENTERED_LEFT : case PUPLACE_CENTERED_RIGHT : default : - //yy = ( bbox.max[1] - bbox.min[1] - labelFont.getStringHeight () ) / 2 ; yy = ( bbox.max[1] - bbox.min[1] + - count_lines( label ) * labelFont.getStringHeight () ) / 2 - - labelFont.getStringHeight() ; + labelFont.getStringHeight ( label ) ) / 2 - + labelFont.getStringHeight () ; break ; case PUPLACE_LOWER_LEFT : |