00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef GLOBALPARAMS_H
00010 #define GLOBALPARAMS_H
00011
00012 #ifdef __GNUC__
00013 #pragma interface
00014 #endif
00015
00016 #include <stdio.h>
00017 #include "gtypes.h"
00018 #include "CharTypes.h"
00019
00020 class GString;
00021 class GList;
00022 class GHash;
00023 class NameToCharCode;
00024 class CharCodeToUnicode;
00025 class CIDToUnicodeCache;
00026 class UnicodeMap;
00027 class UnicodeMapCache;
00028 class CMap;
00029 class CMapCache;
00030 class GlobalParams;
00031
00032
00033
00034
00035 extern GlobalParams *globalParams;
00036
00037
00038
00039 enum DisplayFontParamKind {
00040 displayFontX,
00041 displayFontT1,
00042 displayFontTT
00043 };
00044
00045 class DisplayFontParam {
00046 public:
00047
00048 GString *name;
00049
00050
00051 DisplayFontParamKind kind;
00052 union {
00053 struct {
00054 GString *xlfd;
00055 GString *encoding;
00056 } x;
00057 struct {
00058 GString *fileName;
00059 } t1;
00060 struct {
00061 GString *fileName;
00062 } tt;
00063 };
00064
00065 DisplayFontParam(GString *nameA, DisplayFontParamKind kindA);
00066 DisplayFontParam(char *nameA, char *xlfdA, char *encodingA);
00067 ~DisplayFontParam();
00068 };
00069
00070
00071 enum FontRastControl {
00072 fontRastNone,
00073 fontRastPlain,
00074 fontRastAALow,
00075 fontRastAAHigh
00076 };
00077
00078
00079
00080 class PSFontParam {
00081 public:
00082
00083 GString *pdfFontName;
00084
00085
00086 int wMode;
00087
00088 GString *psFontName;
00089 GString *encoding;
00090
00091 PSFontParam(GString *pdfFontNameA, int wModeA,
00092 GString *psFontNameA, GString *encodingA);
00093 ~PSFontParam();
00094 };
00095
00096
00097
00098 enum PSLevel {
00099 psLevel1,
00100 psLevel1Sep,
00101 psLevel2,
00102 psLevel2Sep,
00103 psLevel3,
00104 psLevel3Sep
00105 };
00106
00107
00108
00109 enum EndOfLineKind {
00110 eolUnix,
00111 eolDOS,
00112 eolMac
00113 };
00114
00115
00116
00117 class GlobalParams {
00118 public:
00119
00120
00121
00122 GlobalParams(char *cfgFileName);
00123
00124 ~GlobalParams();
00125
00126
00127
00128 CharCode getMacRomanCharCode(char *charName);
00129
00130 Unicode mapNameToUnicode(char *charName);
00131 FILE *getCIDToUnicodeFile(GString *collection);
00132 UnicodeMap *getResidentUnicodeMap(GString *encodingName);
00133 FILE *getUnicodeMapFile(GString *encodingName);
00134 FILE *findCMapFile(GString *collection, GString *cMapName);
00135 FILE *findToUnicodeFile(GString *name);
00136 DisplayFontParam *getDisplayFont(GString *fontName);
00137 DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
00138 GString *getPSFile() { return psFile; }
00139 int getPSPaperWidth() { return psPaperWidth; }
00140 int getPSPaperHeight() { return psPaperHeight; }
00141 GBool getPSDuplex() { return psDuplex; }
00142 PSLevel getPSLevel() { return psLevel; }
00143 PSFontParam *getPSFont(GString *fontName);
00144 PSFontParam *getPSFont16(GString *fontName, GString *collection, int wMode);
00145 GBool getPSEmbedType1() { return psEmbedType1; }
00146 GBool getPSEmbedTrueType() { return psEmbedTrueType; }
00147 GBool getPSEmbedCIDPostScript() { return psEmbedCIDPostScript; }
00148 GBool getPSEmbedCIDTrueType() { return psEmbedCIDTrueType; }
00149 GBool getPSOPI() { return psOPI; }
00150 GBool getPSASCIIHex() { return psASCIIHex; }
00151 GString *getTextEncodingName() { return textEncoding; }
00152 EndOfLineKind getTextEOL() { return textEOL; }
00153 GString *findFontFile(GString *fontName, char *ext1, char *ext2);
00154 GString *getInitialZoom() { return initialZoom; }
00155 FontRastControl getT1libControl() { return t1libControl; }
00156 FontRastControl getFreeTypeControl() { return freetypeControl; }
00157 GString *getURLCommand() { return urlCommand; }
00158 GBool getMapNumericCharNames() { return mapNumericCharNames; }
00159 GBool getErrQuiet() { return errQuiet; }
00160
00161 CharCodeToUnicode *getCIDToUnicode(GString *collection);
00162 UnicodeMap *getUnicodeMap(GString *encodingName);
00163 CMap *getCMap(GString *collection, GString *cMapName);
00164 UnicodeMap *getTextEncoding();
00165
00166
00167
00168 void setPSFile(char *file);
00169 GBool setPSPaperSize(char *size);
00170 void setPSPaperWidth(int width);
00171 void setPSPaperHeight(int height);
00172 void setPSDuplex(GBool duplex);
00173 void setPSLevel(PSLevel level);
00174 void setPSEmbedType1(GBool embed);
00175 void setPSEmbedTrueType(GBool embed);
00176 void setPSEmbedCIDPostScript(GBool embed);
00177 void setPSEmbedCIDTrueType(GBool embed);
00178 void setPSOPI(GBool opi);
00179 void setPSASCIIHex(GBool hex);
00180 void setTextEncoding(char *encodingName);
00181 GBool setTextEOL(char *s);
00182 void setInitialZoom(char *s);
00183 GBool setT1libControl(char *s);
00184 GBool setFreeTypeControl(char *s);
00185 void setErrQuiet(GBool errQuietA);
00186
00187 private:
00188
00189 void parseFile(GString *fileName, FILE *f);
00190 void parseNameToUnicode(GList *tokens, GString *fileName, int line);
00191 void parseCIDToUnicode(GList *tokens, GString *fileName, int line);
00192 void parseUnicodeMap(GList *tokens, GString *fileName, int line);
00193 void parseCMapDir(GList *tokens, GString *fileName, int line);
00194 void parseToUnicodeDir(GList *tokens, GString *fileName, int line);
00195 void parseDisplayFont(GList *tokens, GHash *fontHash,
00196 DisplayFontParamKind kind,
00197 GString *fileName, int line);
00198 void parsePSFile(GList *tokens, GString *fileName, int line);
00199 void parsePSPaperSize(GList *tokens, GString *fileName, int line);
00200 void parsePSLevel(GList *tokens, GString *fileName, int line);
00201 void parsePSFont(GList *tokens, GString *fileName, int line);
00202 void parsePSFont16(char *cmdName, GList *fontList,
00203 GList *tokens, GString *fileName, int line);
00204 void parseTextEncoding(GList *tokens, GString *fileName, int line);
00205 void parseTextEOL(GList *tokens, GString *fileName, int line);
00206 void parseFontDir(GList *tokens, GString *fileName, int line);
00207 void parseInitialZoom(GList *tokens, GString *fileName, int line);
00208 void parseFontRastControl(char *cmdName, FontRastControl *val,
00209 GList *tokens, GString *fileName, int line);
00210 void parseURLCommand(GList *tokens, GString *fileName, int line);
00211 void parseYesNo(char *cmdName, GBool *flag,
00212 GList *tokens, GString *fileName, int line);
00213 GBool setFontRastControl(FontRastControl *val, char *s);
00214
00215
00216
00217 NameToCharCode *
00218 macRomanReverseMap;
00219
00220
00221
00222 NameToCharCode *
00223 nameToUnicode;
00224 GHash *cidToUnicodes;
00225
00226
00227 GHash *residentUnicodeMaps;
00228
00229 GHash *unicodeMaps;
00230
00231 GHash *cMapDirs;
00232
00233 GList *toUnicodeDirs;
00234 GHash *displayFonts;
00235
00236 GHash *displayCIDFonts;
00237
00238 GHash *displayNamedCIDFonts;
00239
00240 GString *psFile;
00241 int psPaperWidth;
00242 int psPaperHeight;
00243 GBool psDuplex;
00244 PSLevel psLevel;
00245 GHash *psFonts;
00246
00247 GList *psNamedFonts16;
00248 GList *psFonts16;
00249 GBool psEmbedType1;
00250 GBool psEmbedTrueType;
00251 GBool psEmbedCIDPostScript;
00252 GBool psEmbedCIDTrueType;
00253 GBool psOPI;
00254 GBool psASCIIHex;
00255 GString *textEncoding;
00256
00257 EndOfLineKind textEOL;
00258
00259 GList *fontDirs;
00260 GString *initialZoom;
00261 FontRastControl t1libControl;
00262 FontRastControl
00263 freetypeControl;
00264 GString *urlCommand;
00265 GBool mapNumericCharNames;
00266 GBool errQuiet;
00267
00268 CIDToUnicodeCache *cidToUnicodeCache;
00269 UnicodeMapCache *unicodeMapCache;
00270 CMapCache *cMapCache;
00271 };
00272
00273 #endif