]> icculus.org git repositories - taylor/freespace2.git/blob - src/fonttool/fonttool.cpp
various files ported needed for fonttool. There is a bug where on exit it segfaults...
[taylor/freespace2.git] / src / fonttool / fonttool.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Fonttool/FontTool.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Tool for creating/kerning fonts
16  *
17  * $Log$
18  * Revision 1.4  2003/01/30 20:03:48  relnev
19  * various files ported needed for fonttool.  There is a bug where on exit it segfaults in SDL_GL_SwapBuffers, I'm probably missing something (don't know what) but it works fine otherwise (Taylor Richards)
20  *
21  * Revision 1.3  2002/06/09 04:41:16  relnev
22  * added copyright header
23  *
24  * Revision 1.2  2002/05/07 03:16:43  theoddone33
25  * The Great Newline Fix
26  *
27  * Revision 1.1.1.1  2002/05/03 03:28:08  root
28  * Initial import.
29  *
30  * 
31  * 2     10/24/98 5:15p Dave
32  * 
33  * 1     10/24/98 4:58p Dave
34  * 
35  * 4     10/30/97 4:56p John
36  * Fixed up font stuff to build.  Fixed bug where it didn't show the last
37  * 3 characters in kerning table.
38  * 
39  * 3     6/23/97 6:05p Hoffoss
40  * Added stubbs to fix linking errors.
41  * 
42  * 2     6/05/97 4:53p John
43  * First rev of new antialiased font stuff.
44  * 
45  * 1     6/02/97 4:04p John
46  *
47  * $NoKeywords: $
48  */
49
50 #include <stdlib.h>
51 #include <stdio.h>
52 #ifndef PLAT_UNIX
53 #include <io.h>
54 #include <conio.h>
55 #endif
56
57 #include "pstypes.h"
58 #include "osapi.h"
59 #include "cfile.h"
60 #include "2d.h"
61 #include "key.h"
62 #include "mouse.h"
63 #include "palman.h"
64 #include "timer.h"
65
66 #include "fonttool.h"
67
68 char Usage[] = "Usage:\n"       \
69 "\nFontTool x.pcx [y.vf]\n" \
70 "\n  If you specify a PCX file, then a font will be\n" \
71 "  created with the same base name.   If you also\n" \
72 "  specify a font file, then it will use the kerning\n" \
73 "  data from that font file when it creates the new\n" \
74 "  font from the PCX file.\n" \
75 "\nFontTool x.vf\n" \
76 "\n  If you specify a font file by itself then it will\n" \
77 "  allow you to interactively kern that font.\n" \
78 "\nFontTool x.vf y.vf\n" \
79 "\n  If you specify two font files, then the kerning\n" \
80 "  data from the first font will be copied into the\n" \
81 "  second font.\n" \
82 "\n";
83
84 #define NONE 0
85 #define PCX 1
86 #define FONT 2
87
88 int Font1 = -1;
89
90 void demo_set_playback_filter() {}
91 float flFrametime = 0.0f;
92
93 void freespace_menu_background()
94 {
95         gr_reset_clip();
96         gr_clear();
97 }
98
99 int main(int argc, char *argv[] )
100 {
101         int t1, t2;
102
103         t1 = NONE;
104         t2 = NONE;
105
106         if ( (argc < 1) || (argc>3) )   {
107                 printf( Usage );
108                 return 1;
109         }
110
111         if ( argc > 1 ) {
112                 strlwr( argv[1] );
113
114                 if ( strstr( argv[1], ".pcx" ) )
115                         t1 = PCX;
116                 else if ( strstr( argv[1], ".vf" ) )
117                         t1 = FONT;
118         }
119
120         if ( argc > 2 ) {
121                 strlwr( argv[2] );
122
123                 if ( strstr( argv[2], ".pcx" ) )
124                         t2 = PCX;
125                 else if ( strstr( argv[2], ".vf" ) )
126                         t2 = FONT;
127         }
128
129         if ( (t1==PCX) && (t2==NONE) )
130                 fonttool_create_font( argv[1], NULL );
131         else if ( (t1==PCX) && (t2==FONT) )
132                 fonttool_create_font( argv[1], argv[2] );
133         else if ( (t1==FONT) && (t2==NONE) )
134 #ifdef PLAT_UNIX
135                 fonttool_edit_kerning( argv[1], NULL );
136 #else
137                 fonttool_edit_kerning( argv[1] );
138 #endif
139         else if ( (t1==FONT) && (t2==FONT) )
140                 fonttool_kerning_copy( argv[1], argv[2] );
141         else
142                 printf( Usage );
143
144         return 0;
145 }
146