adding glutStrokeWidthf and glutStrokeLengthf from GLUT 3.8
authorDiederick Niehorster <dcnieho@gmail.com>
Fri, 17 Oct 2014 16:28:24 +0000 (16:28 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Fri, 17 Oct 2014 16:28:24 +0000 (16:28 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1718 7f0cb862-5218-0410-a997-914c9d46530a

include/GL/freeglut_ext.h
include/GL/freeglut_std.h
src/fg_ext.c
src/fg_font.c

index b856959..0c22c4f 100644 (file)
@@ -202,7 +202,7 @@ FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
 
 #define GLUT_HAS_MULTI 1
 
-/* TODO: add device_id paramater,
+/* TODO: add device_id parameter,
    cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
 FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
 FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
index 0e4ce6c..a658c7c 100644 (file)
@@ -529,8 +529,10 @@ FGAPI void    FGAPIENTRY glutBitmapCharacter( void* font, int character );
 FGAPI int     FGAPIENTRY glutBitmapWidth( void* font, int character );
 FGAPI void    FGAPIENTRY glutStrokeCharacter( void* font, int character );
 FGAPI int     FGAPIENTRY glutStrokeWidth( void* font, int character );
+FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
 FGAPI int     FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
 FGAPI int     FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
+FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
 
 /*
  * Geometry functions, see fg_geometry.c
index ab601c7..d96849a 100644 (file)
@@ -125,8 +125,10 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
     CHECK_NAME(glutBitmapWidth);
     CHECK_NAME(glutStrokeCharacter);
     CHECK_NAME(glutStrokeWidth);
+    CHECK_NAME(glutStrokeWidthf);
     CHECK_NAME(glutBitmapLength);
     CHECK_NAME(glutStrokeLength);
+    CHECK_NAME(glutStrokeLengthf);
     CHECK_NAME(glutWireSphere);
     CHECK_NAME(glutSolidSphere);
     CHECK_NAME(glutWireCone);
index 4a23e1d..7502a0b 100644 (file)
@@ -346,7 +346,7 @@ void FGAPIENTRY glutStrokeString( void* fontID, const unsigned char *string )
 /*
  * Return the width in pixels of a stroke character
  */
-int FGAPIENTRY glutStrokeWidth( void* fontID, int character )
+GLfloat FGAPIENTRY glutStrokeWidthf( void* fontID, int character )
 {
     const SFG_StrokeChar *schar;
     SFG_StrokeFont* font;
@@ -364,17 +364,21 @@ int FGAPIENTRY glutStrokeWidth( void* fontID, int character )
     schar = font->Characters[ character ];
     freeglut_return_val_if_fail( schar, 0 );
 
-    return ( int )( schar->Right + 0.5 );
+    return schar->Right;
+}
+int FGAPIENTRY glutStrokeWidth(void* fontID, int character)
+{
+    return ( int )( glutStrokeWidthf(fontID,character) + 0.5f );
 }
 
 /*
  * Return the width of a string drawn using a stroke font
  */
-int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
+GLfloat FGAPIENTRY glutStrokeLengthf( void* fontID, const unsigned char* string )
 {
     unsigned char c;
-    float length = 0.0;
-    float this_line_length = 0.0;
+    GLfloat length = 0.0;
+    GLfloat this_line_length = 0.0;
     SFG_StrokeFont* font;
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeLength" );
     font = fghStrokeByID( fontID );
@@ -404,7 +408,11 @@ int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
         }
     if( length < this_line_length )
         length = this_line_length;
-    return( int )( length + 0.5 );
+    return length;
+}
+int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
+{
+    return( int )( glutStrokeLengthf(fontID,string) + 0.5f );
 }
 
 /*