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