* Matches a font ID with a SFG_Font structure pointer.
* This was changed to match the GLUT header style.
*/
-static SFG_Font* fghFontByID( void* font )
+SFG_Font* fghFontByID( void* font )
{
if( font == GLUT_BITMAP_8_BY_13 )
return &fgFontFixed8x13;
if( font == GLUT_BITMAP_TIMES_ROMAN_24 )
return &fgFontTimesRoman24;
- fgWarning( "font 0x%08x not found", font );
return 0;
}
if( font == GLUT_STROKE_MONO_ROMAN )
return &fgStrokeMonoRoman;
- fgWarning( "stroke font 0x%08x not found", font );
return 0;
}
SFG_Font* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapCharacter" );
font = fghFontByID( fontID );
+ if (!font)
+ {
+ fgWarning("glutBitmapCharacter: bitmap font 0x%08x not found. Make sure you're not passing a stroke font.\n",fontID);
+ return;
+ }
freeglut_return_if_fail( ( character >= 1 )&&( character < 256 ) );
- freeglut_return_if_fail( font );
/*
* Find the character we want to draw (???)
SFG_Font* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapString" );
font = fghFontByID( fontID );
- freeglut_return_if_fail( font );
+ if (!font)
+ {
+ fgWarning("glutBitmapString: bitmap font 0x%08x not found. Make sure you're not passing a stroke font.\n",fontID);
+ return;
+ }
if ( !string || ! *string )
return;
{
SFG_Font* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapWidth" );
- font = fghFontByID( fontID );
freeglut_return_val_if_fail( character > 0 && character < 256, 0 );
- freeglut_return_val_if_fail( font, 0 );
+ font = fghFontByID( fontID );
+ if (!font)
+ {
+ fgWarning("glutBitmapWidth: bitmap font 0x%08x not found. Make sure you're not passing a stroke font.\n",fontID);
+ return 0;
+ }
return *( font->Characters[ character ] );
}
SFG_Font* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapLength" );
font = fghFontByID( fontID );
- freeglut_return_val_if_fail( font, 0 );
+ if (!font)
+ {
+ fgWarning("glutBitmapLength: bitmap font 0x%08x not found. Make sure you're not passing a stroke font.\n",fontID);
+ return 0;
+ }
if ( !string || ! *string )
return 0;
SFG_Font* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapHeight" );
font = fghFontByID( fontID );
- freeglut_return_val_if_fail( font, 0 );
+ if (!font)
+ {
+ fgWarning("glutBitmapHeight: bitmap font 0x%08x not found. Make sure you're not passing a stroke font.\n",fontID);
+ return 0;
+ }
return font->Height;
}
SFG_StrokeFont* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeCharacter" );
font = fghStrokeByID( fontID );
+ if (!font)
+ {
+ fgWarning("glutStrokeCharacter: stroke font 0x%08x not found. Make sure you're not passing a bitmap font.\n",fontID);
+ return;
+ }
freeglut_return_if_fail( character >= 0 );
freeglut_return_if_fail( character < font->Quantity );
- freeglut_return_if_fail( font );
schar = font->Characters[ character ];
freeglut_return_if_fail( schar );
SFG_StrokeFont* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeString" );
font = fghStrokeByID( fontID );
- freeglut_return_if_fail( font );
+ if (!font)
+ {
+ fgWarning("glutStrokeString: stroke font 0x%08x not found. Make sure you're not passing a bitmap font.\n",fontID);
+ return;
+ }
if ( !string || ! *string )
return;
SFG_StrokeFont* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeWidth" );
font = fghStrokeByID( fontID );
+ if (!font)
+ {
+ fgWarning("glutStrokeWidth: stroke font 0x%08x not found. Make sure you're not passing a bitmap font.\n",fontID);
+ return 0;
+ }
freeglut_return_val_if_fail( ( character >= 0 ) &&
( character < font->Quantity ),
0
);
- freeglut_return_val_if_fail( font, 0 );
schar = font->Characters[ character ];
freeglut_return_val_if_fail( schar, 0 );
SFG_StrokeFont* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeLength" );
font = fghStrokeByID( fontID );
- freeglut_return_val_if_fail( font, 0 );
+ if (!font)
+ {
+ fgWarning("glutStrokeLength: stroke font 0x%08x not found. Make sure you're not passing a bitmap font.\n",fontID);
+ return 0;
+ }
if ( !string || ! *string )
return 0;
SFG_StrokeFont* font;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeHeight" );
font = fghStrokeByID( fontID );
- freeglut_return_val_if_fail( font, 0.0 );
+ if (!font)
+ {
+ fgWarning("glutStrokeHeight: stroke font 0x%08x not found. Make sure you're not passing a bitmap font.\n",fontID);
+ return 0.f;
+ }
return font->Height;
}