1 //==============================================================================================
2 //  font3d.h                                                                       Font3D
3 //----------------------------------------------------------------------------------------------
4 //
5 //  Copyright (c) 1994-1996 by Todd A. Prater                                   Version 1.60
6 //  All rights reserved.
7 //
8 //----------------------------------------------------------------------------------------------
9 //
10 //  Permission to copy and distribute Font3D in its entirety, for non�commercial purposes,
11 //  is hereby granted without fee, provided that this license information and copyright
12 //  notice appear in all copies.
13 //
14 //  If you redistribute Font3D, the entire contents of this distribution must be distributed,
15 //  including the readme.txt, and register.txt files, and the complete set of documentation,
16 //  both ASCII text, and PostScript files.
17 //
18 //  The software may be modified for your own purposes, but modified versions may not be
19 //  distributed without prior consent of the author.
20 //
21 //  This software is provided 'as�is', without any express or implied warranty.  In no event
22 //  will the author be held liable for any damages arising from the use of this software.
23 //
24 //  If you would like to do something with Font3D that this copyright prohibits (such as
25 //  distributing it with a commercial product, using portions of the source in some other
26 //  program, distributing registered copies, etc.), please contact the author (preferably
27 //  via email).  Arrangements can probably be worked out.
28 //
29 //==============================================================================================
30 
31 #ifndef __FONT3D_H__
32 #define __FONT3D_H__
33 
34 #include <fstream.h>
35 #include <stddef.h>
36 
37 #define RIGHT_HANDED          0
38 #define LEFT_HANDED           1
39 
40 #define F3D_ERR_NoError           0
41 #define F3D_ERR_OutOfMemory       1
42 #define F3D_ERR_TableNotFound     2
43 #define F3D_ERR_UnknownCmapFormat 3
44 #define F3D_ERR_UnknownKernFormat 4
45 #define F3D_ERR_UnableToOpenFile  6
46 #define F3D_ERR_NoOptionsFound    8
47 #define F3D_ERR_InvalidOption     9
48 #define F3D_ERR_NoPolyFound      10
49 #define F3D_ERR_UnmatchedQuotes  11
50 
51 #define RAW                   0
52 #define POV                   1
53 #define POV3                  2
54 #define RIB                   3
55 #define DXF                   4
56 #define DXF2                  5
57 #define VIVID                 6
58 #define ROUND                 7
59 #define FLAT                  8
60 #define SMOOTH                9
61 #define LEFT                 10
62 #define RIGHT                11
63 #define CENTER               12
64 #define BOTTOM               13
65 #define BASELINE             14
66 #define TOP                  15
67 #define BACK                 16
68 #define FRONT                17
69 #define RAD                  18
70 #define TK					 19
71 
72 #define OFF                   0
73 #define ON                    1
74 
75 #define MAC                   0
76 #define MS                    1
77 
78 #define USENGLISH 0
79 #define UKENGLISH 1
80 
81 #define DEGENERATE_THRESHOLD 1.0e-9
82 
83 #define MAX_STRING_SIZE 1024
84 #define MAX_NUM_OPTIONS  200
85 #define MAX_LINE_LENGTH 2048
86 #define MAX_OPTIONS      200
87 
88 #define MAX_FILENAME_SIZE 1024
89 
90 #define SINGLE_QUOTE_CHAR '\''
91 #define DOUBLE_QUOTE_CHAR '"'
92 #define COMMENT_CHAR      '#'
93 
94 
95    class Font3DOptions
96    {
97       public:
98          char*   fontFileName;
99          char*   fontPathName;
100          char*   outputFileName;
101          char*   outputPathName;
102          char*   objectName;
103          int     outputFormat;
104          int     bevelType;
105          int     triangleType;
106          double  depth;
107          int     xPosition;
108          int     yPosition;
109          int     zPosition;
110          int     frontFaceVisible;
111          int     backFaceVisible;
112          int     frontBevelVisible;
113          int     backBevelVisible;
114          int     sideVisible;
115          int     stringLength;
116          int*    string;
117          double  frontFaceCut;
118          double  backFaceCut;
119          double  frontSideCut;
120          double  backSideCut;
121          char*   frontFaceTextureName;
122          char*   backFaceTextureName;
123          char*   frontBevelTextureName;
124          char*   backBevelTextureName;
125          char*   sideTextureName;
126          double  spacing;
127          double  spaceto;
128          double  threshold;
129          int     resolution;
130          int     mapType;
131          int     language;
132          int     outputPrecision;
133          int     verbose;
134          int     constants;
135          int     csystem;
136          int     reverse;
137          double  reverseBorderVertical;
138          double  reverseBorderHorizontal;
139 
Font3DOptions()140          Font3DOptions()
141          {
142             fontFileName          = NULL;
143             fontPathName          = NULL;
144 
145             outputFileName        = new char[12];
146             strcpy (outputFileName,"font3d.inc");
147 
148             outputPathName        = NULL;
149 
150             objectName            = new char[14];
151             strcpy (objectName,"FONT3D_OBJECT");
152 
153             outputFormat          = POV;
154             bevelType             = FLAT;
155             triangleType          = SMOOTH;
156             depth                 = 0.2;
157             xPosition             = CENTER;
158             yPosition             = CENTER;
159             zPosition             = CENTER;
160             frontFaceVisible      = TRUE;
161             backFaceVisible       = TRUE;
162             frontBevelVisible     = TRUE;
163             backBevelVisible      = TRUE;
164             sideVisible           = TRUE;
165 
166             string                = new int[strlen("Font3D")];
167             stringLength          = strlen("Font3D");
168             for (unsigned int i=0;i<strlen("Font3D");i++)
169                string[i]=("Font3D")[i];
170 
171             frontFaceCut          = 0.0;
172             backFaceCut           = 0.0;
173             frontSideCut          = 0.0;
174             backSideCut           = 0.0;
175             frontFaceTextureName  = NULL;
176             backFaceTextureName   = NULL;
177             frontBevelTextureName = NULL;
178             backBevelTextureName  = NULL;
179             sideTextureName       = NULL;
180             spacing               = 0.0;
181             spaceto               = 0.0;
182             threshold             = 0.4;  /* ? */
183             resolution            = 5;
184             mapType               = MICROSOFT;
185             language              = LID_MS_USEnglish;
186             outputPrecision       = 6;
187             verbose               = TRUE;
188             constants             = TRUE;
189             csystem               = RIGHT_HANDED;
190             reverse               = FALSE;
191             reverseBorderVertical = 0.01;
192             reverseBorderHorizontal = 0.01;
193          }
194 
195    };
196 
197    int ReadOptions(char* fileName, int& numArgs, char ** & args);
198 
199    int ParseOptions(int numArgs, char* argument[], Font3DOptions& defaultOptions,
200                     int& errorCode, int& errorPos);
201 
202 #endif
203 
204 
205 
206 
207