]> icculus.org git repositories - taylor/freespace2.git/blob - src/fonttool/fonttool.cpp
use a better multi_sw_ok_to_commit() check
[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 static const 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 int Fonttool_running = 1;
91
92 void demo_set_playback_filter() {}
93 float flFrametime = 0.0f;
94
95 void freespace_menu_background()
96 {
97         gr_reset_clip();
98         gr_clear();
99 }
100
101 extern "C"
102 int main(int argc, char *argv[] )
103 {
104         int t1, t2;
105
106         t1 = NONE;
107         t2 = NONE;
108
109         if ( (argc < 1) || (argc>3) )   {
110                 printf( Usage );
111                 return 1;
112         }
113
114         if ( argc > 1 ) {
115                 SDL_strlwr( argv[1] );
116
117                 if ( strstr( argv[1], ".pcx" ) )
118                         t1 = PCX;
119                 else if ( strstr( argv[1], ".vf" ) )
120                         t1 = FONT;
121         }
122
123         if ( argc > 2 ) {
124                 SDL_strlwr( argv[2] );
125
126                 if ( strstr( argv[2], ".pcx" ) )
127                         t2 = PCX;
128                 else if ( strstr( argv[2], ".vf" ) )
129                         t2 = FONT;
130         }
131
132         if ( (t1==PCX) && (t2==NONE) )
133                 fonttool_create_font( argv[1], NULL );
134         else if ( (t1==PCX) && (t2==FONT) )
135                 fonttool_create_font( argv[1], argv[2] );
136         else if ( (t1==FONT) && (t2==NONE) )
137                 fonttool_edit_kerning( argv[1] );
138         else if ( (t1==FONT) && (t2==FONT) )
139                 fonttool_kerning_copy( argv[1], argv[2] );
140         else
141                 printf( Usage );
142
143         return 0;
144 }
145