-/*
- * main.c
- *
- * A simple utility to generate the stroke fonts to be used in freeglut.
- *
- * Copyright (c) 1999-2000 by Pawel W. Olszta
- * Written by Pawel W. Olszta, <olszta@sourceforge.net>
- * Creation date: czw sty 06 19:42:30 CET 2000
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software")
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Sotware.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifdef HAVE_CONFIG_H
- #include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-/*
- * Define the log domain
- */
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "genstroke"
-
-/*
- * The alphabet we want to export.
- */
-char* g_Alphabet = " abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789`~!@#$%^&*()-_=+[{}];:,.<>/?\\\"";
-int g_AlphabetLength = 0;
-
-/*
- * All undefined characters will get replaced by this one:
- */
-char g_NoChar = '*';
-
-/*
- * The stream we want to redirect our output to
- */
-FILE* g_Output = NULL;
-
-/*
- * Our argv[0]
- */
-char *g_ProgName = "";
-
-/*
- * This function outputs the font file prologue
- */
-void OutputPrologue( char* fileName )
-{
- /*
- * Output the copyright and permission notices:
- */
- fprintf( g_Output, "/*\n * %s\n *\n * This file has been automatically generated by the genfonts utility.\n *\n", fileName );
- fprintf( g_Output, " * Copyright (c) 1999-2000 by Pawel W. Olszta\n * Written by Pawel W. Olszta, <olszta@sourceforge.net>\n * \n" );
- fprintf( g_Output, " * Permission is hereby granted, free of charge, to any person obtaining a\n" );
- fprintf( g_Output, " * copy of this software and associated documentation files (the \"Software\"),\n" );
- fprintf( g_Output, " * to deal in the Software without restriction, including without limitation\n" );
- fprintf( g_Output, " * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n" );
- fprintf( g_Output, " * and/or sell copies of the Software, and to permit persons to whom the\n" );
- fprintf( g_Output, " * Software is furnished to do so, subject to the following conditions:\n *\n" );
- fprintf( g_Output, " * The above copyright notice and this permission notice shall be included\n" );
- fprintf( g_Output, " * in all copies or substantial portions of the Sotware.\n *\n" );
- fprintf( g_Output, " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n" );
- fprintf( g_Output, " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" );
- fprintf( g_Output, " * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n" );
- fprintf( g_Output, " * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n" );
- fprintf( g_Output, " * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n" );
- fprintf( g_Output, " * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n" );
-
- /*
- * The obvious include headers
- */
- fprintf( g_Output, "\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"../include/GL/freeglut.h\"\n#include \"../include/GL/freeglut_internal.h\"\n" );
-}
-
-/*
- * This function outputs a font set
- */
-void OutputFont( char* freeglutFontName, char* fontName )
-{
- /*
- * This is an easy one. I just have to write a parser for the SRC files
- * and dump their contents to the output file. Expect this to be done
- * this weekend. The output data should be organized just like the bitmap
- * fonts data, as it shown to be good.
- */
-}
-
-/*
- * This function outputs the font file epilogue
- */
-void OutputEpilogue( void )
-{
- fprintf( g_Output, "/*** END OF FILE ***/\n" );
-}
-
-/*
- * The main function processes the command line arguments
- * and outputs all the fonts we need to have rasterized.
- */
-int main( int argc, char** argv )
-{
- char ourCharacter[ 2 ] = { 0, 0 };
- char* outputFileName = NULL;
- int i = 1;
-
- g_ProgName = argv[0];
-
- /*
- * Initialize the alphabet's length
- */
- g_AlphabetLength = strlen( g_Alphabet );
-
- /*
- * Make sure that the no-character character is in the alphabet
- */
- ourCharacter[ 0 ] = g_NoChar;
-
- if( strstr( g_Alphabet, ourCharacter ) == NULL )
- {
- fprintf( stderr,
- "%s: the g_NoChar `%c' character not found in the alphabet `%s'\n",
- g_ProgName, g_NoChar, g_Alphabet );
- exit( 1 );
- }
-
- /*
- * Define the default output file name
- */
- outputFileName = strdup( "freeglut_font_stroke.c" );
-
- /*
- * Process the command line arguments now. Command line arguments expected:
- *
- * -file <FILENAME> -- the destination file name
- */
- while( i < argc )
- {
- /*
- * See what the current token is
- */
- if( strcasecmp( argv[ i ], "-file" ) == 0 )
- {
- assert( (i + 1) < argc );
- free( outputFileName );
-
- /*
- * The next token is expected to contain the destination file name
- */
- outputFileName = strdup( argv[ ++i ] );
- }
-
- /*
- * Get to the next argument
- */
- i++;
- }
-
- /*
- * Have the destination file opened
- */
- g_Output = fopen( outputFileName, "wt" );
- assert( g_Output != NULL );
-
- /*
- * Output the file header first
- */
- OutputPrologue( outputFileName );
-
- /*
- * Output all of the fonts we want to output
- */
- OutputFont( "Roman", "Roman.src" );
- OutputFont( "RomanMono", "Roman_M.src" );
-
- /*
- * Finally, have the file epilogue outputted
- */
- OutputEpilogue();
-
- /*
- * Close the output stream
- */
- fclose( g_Output );
-
- /*
- * Clean up all the rest of the mess
- */
- free( outputFileName );
-
- /*
- * Return successful!
- */
- return( EXIT_SUCCESS );
-}
-
-/*** END OF FILE ***/