X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_font.c;h=46e22194212990adc4fd52f228ea98b93453ed00;hb=4718a4ac2bad82816c5169dcdd16967d058d6810;hp=20bbed41770cfea213dc5436b00092aef801e074;hpb=a82e219413778d1fd55d270af98e9ad6a97e25a0;p=freeglut diff --git a/freeglut-1.3/freeglut_font.c b/freeglut-1.3/freeglut_font.c index 20bbed4..46e2219 100644 --- a/freeglut-1.3/freeglut_font.c +++ b/freeglut-1.3/freeglut_font.c @@ -32,7 +32,7 @@ #define G_LOG_DOMAIN "freeglut-font" #include "../include/GL/freeglut.h" -#include "../include/GL/freeglut_internal.h" +#include "freeglut_internal.h" /* * TODO BEFORE THE STABLE RELEASE: @@ -164,7 +164,7 @@ void FGAPIENTRY glutBitmapCharacter( void* fontID, int character ) glBitmap( face[ 0 ], font->Height, /* The bitmap's width and height */ font->xorig, font->yorig, /* The origin -- what on earth? */ - (float)(face[ 0 ] + 1), 0.0, /* The raster advance -- inc. x */ + (float)(face[ 0 ]), 0.0, /* The raster advance -- inc. x */ (face + 1) /* The packed bitmap data... */ ); @@ -209,27 +209,24 @@ void FGAPIENTRY glutBitmapString( void* fontID, const char *string ) */ for( c = 0; c < numchar; c++ ) { - if ( ( string[ c ] >= 0 ) && ( string[ c ] < 256 ) ) + if ( string[c] == '\n' ) { - if ( string[c] == '\n' ) - { - raster_position[1] -= (float)font->Height ; - glRasterPos4fv ( raster_position ) ; - } - else /* Not a carriage return, draw the bitmap character */ - { - const GLubyte* face = font->Characters[ string[ c ] - 1 ] ; - - /* - * We'll use a glBitmap call to draw the font. - */ - glBitmap( - face[ 0 ], font->Height, /* The bitmap's width and height */ - font->xorig, font->yorig, /* The origin -- what on earth? */ - (float)(face[ 0 ] + 1), 0.0, /* The raster advance -- inc. x */ - (face + 1) /* The packed bitmap data... */ - ) ; - } + raster_position[1] -= (float)font->Height ; + glRasterPos4fv ( raster_position ) ; + } + else /* Not a carriage return, draw the bitmap character */ + { + const GLubyte* face = font->Characters[ string[ c ] - 1 ] ; + + /* + * We'll use a glBitmap call to draw the font. + */ + glBitmap( + face[ 0 ], font->Height, /* The bitmap's width and height */ + font->xorig, font->yorig, /* The origin -- what on earth? */ + (float)(face[ 0 ]), 0.0, /* The raster advance -- inc. x */ + (face + 1) /* The packed bitmap data... */ + ) ; } } @@ -257,7 +254,7 @@ int FGAPIENTRY glutBitmapWidth( void* fontID, int character ) /* * Scan the font looking for the specified character */ - return( *(font->Characters[ character - 1 ]) + 1 ); + return( *(font->Characters[ character - 1 ]) ); } /* @@ -278,16 +275,13 @@ int FGAPIENTRY glutBitmapLength( void* fontID, const char* string ) int numchar = strlen ( string ) ; for( c = 0; c < numchar; c++ ) { - if ( ( string[ c ] >= 0 ) && ( string[ c ] < 256 ) ) + if ( string[ c ] == '\n' ) /* Carriage return, reset the length of this line */ { - if ( string[ c ] == '\n' ) /* Carriage return, reset the length of this line */ - { - if ( length < this_line_length ) length = this_line_length ; - this_line_length = 0 ; - } - else /* Not a carriage return, increment the length of this line */ - this_line_length += *(font->Characters[ string[ c ] - 1 ]) + 1 ; + if ( length < this_line_length ) length = this_line_length ; + this_line_length = 0 ; } + else /* Not a carriage return, increment the length of this line */ + this_line_length += *(font->Characters[ string[ c ] - 1 ]) ; } if ( length < this_line_length ) length = this_line_length ;