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 #if MULTITHREADED
00023 #include "GMutex.h"
00024 #endif
00025
00026 class GString;
00027 class GList;
00028 class GHash;
00029 class NameToCharCode;
00030 class CharCodeToUnicode;
00031 class CharCodeToUnicodeCache;
00032 class UnicodeMap;
00033 class UnicodeMapCache;
00034 class CMap;
00035 class CMapCache;
00036 class GlobalParams;
00037
00038
00039
00040
00041 extern GlobalParams *globalParams;
00042
00043
00044
00045 enum DisplayFontParamKind {
00046 displayFontT1,
00047 displayFontTT
00048 };
00049
00050 class DisplayFontParam {
00051 public:
00052
00053 GString *name;
00054
00055
00056 DisplayFontParamKind kind;
00057 union {
00058 struct {
00059 GString *fileName;
00060 } t1;
00061 struct {
00062 GString *fileName;
00063 } tt;
00064 };
00065
00066 DisplayFontParam(GString *nameA, DisplayFontParamKind kindA);
00067 ~DisplayFontParam();
00068 };
00069
00070
00071
00072 class PSFontParam {
00073 public:
00074
00075 GString *pdfFontName;
00076
00077
00078 int wMode;
00079
00080 GString *psFontName;
00081 GString *encoding;
00082
00083 PSFontParam(GString *pdfFontNameA, int wModeA,
00084 GString *psFontNameA, GString *encodingA);
00085 ~PSFontParam();
00086 };
00087
00088
00089
00090 enum PSLevel {
00091 psLevel1,
00092 psLevel1Sep,
00093 psLevel2,
00094 psLevel2Sep,
00095 psLevel3,
00096 psLevel3Sep
00097 };
00098
00099
00100
00101 enum EndOfLineKind {
00102 eolUnix,
00103 eolDOS,
00104 eolMac
00105 };
00106
00107
00108
00109 class GlobalParams {
00110 public:
00111
00112
00113
00114 GlobalParams(char *cfgFileName);
00115
00116 ~GlobalParams();
00117
00118 void setupBaseFonts(char *dir);
00119
00120
00121
00122 CharCode getMacRomanCharCode(char *charName);
00123
00124 Unicode mapNameToUnicode(char *charName);
00125 UnicodeMap *getResidentUnicodeMap(GString *encodingName);
00126 FILE *getUnicodeMapFile(GString *encodingName);
00127 FILE *findCMapFile(GString *collection, GString *cMapName);
00128 FILE *findToUnicodeFile(GString *name);
00129 DisplayFontParam *getDisplayFont(GString *fontName);
00130 DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
00131 GString *getPSFile();
00132 int getPSPaperWidth();
00133 int getPSPaperHeight();
00134 void getPSImageableArea(int *llx, int *lly, int *urx, int *ury);
00135 GBool getPSDuplex();
00136 GBool getPSCrop();
00137 GBool getPSExpandSmaller();
00138 GBool getPSShrinkLarger();
00139 GBool getPSCenter();
00140 PSLevel getPSLevel();
00141 PSFontParam *getPSFont(GString *fontName);
00142 PSFontParam *getPSFont16(GString *fontName, GString *collection, int wMode);
00143 GBool getPSEmbedType1();
00144 GBool getPSEmbedTrueType();
00145 GBool getPSEmbedCIDPostScript();
00146 GBool getPSEmbedCIDTrueType();
00147 GBool getPSOPI();
00148 GBool getPSASCIIHex();
00149 GString *getTextEncodingName();
00150 EndOfLineKind getTextEOL();
00151 GBool getTextPageBreaks();
00152 GBool getTextKeepTinyChars();
00153 GString *findFontFile(GString *fontName, char **exts);
00154 GString *getInitialZoom();
00155 GBool getEnableT1lib();
00156 GBool getEnableFreeType();
00157 GBool getAntialias();
00158 GString *getURLCommand() { return urlCommand; }
00159 GString *getMovieCommand() { return movieCommand; }
00160 GBool getMapNumericCharNames();
00161 GBool getPrintCommands();
00162 GBool getErrQuiet();
00163
00164 CharCodeToUnicode *getCIDToUnicode(GString *collection);
00165 CharCodeToUnicode *getUnicodeToUnicode(GString *fontName);
00166 UnicodeMap *getUnicodeMap(GString *encodingName);
00167 CMap *getCMap(GString *collection, GString *cMapName);
00168 UnicodeMap *getTextEncoding();
00169
00170
00171
00172 void addDisplayFont(DisplayFontParam *param);
00173 void setPSFile(char *file);
00174 GBool setPSPaperSize(char *size);
00175 void setPSPaperWidth(int width);
00176 void setPSPaperHeight(int height);
00177 void setPSImageableArea(int llx, int lly, int urx, int ury);
00178 void setPSDuplex(GBool duplex);
00179 void setPSCrop(GBool crop);
00180 void setPSExpandSmaller(GBool expand);
00181 void setPSShrinkLarger(GBool shrink);
00182 void setPSCenter(GBool center);
00183 void setPSLevel(PSLevel level);
00184 void setPSEmbedType1(GBool embed);
00185 void setPSEmbedTrueType(GBool embed);
00186 void setPSEmbedCIDPostScript(GBool embed);
00187 void setPSEmbedCIDTrueType(GBool embed);
00188 void setPSOPI(GBool opi);
00189 void setPSASCIIHex(GBool hex);
00190 void setTextEncoding(char *encodingName);
00191 GBool setTextEOL(char *s);
00192 void setTextPageBreaks(GBool pageBreaks);
00193 void setTextKeepTinyChars(GBool keep);
00194 void setInitialZoom(char *s);
00195 GBool setEnableT1lib(char *s);
00196 GBool setEnableFreeType(char *s);
00197 GBool setAntialias(char *s);
00198 void setMapNumericCharNames(GBool map);
00199 void setPrintCommands(GBool printCommandsA);
00200 void setErrQuiet(GBool errQuietA);
00201
00202 private:
00203
00204 void parseFile(GString *fileName, FILE *f);
00205 void parseNameToUnicode(GList *tokens, GString *fileName, int line);
00206 void parseCIDToUnicode(GList *tokens, GString *fileName, int line);
00207 void parseUnicodeToUnicode(GList *tokens, GString *fileName, int line);
00208 void parseUnicodeMap(GList *tokens, GString *fileName, int line);
00209 void parseCMapDir(GList *tokens, GString *fileName, int line);
00210 void parseToUnicodeDir(GList *tokens, GString *fileName, int line);
00211 void parseDisplayFont(GList *tokens, GHash *fontHash,
00212 DisplayFontParamKind kind,
00213 GString *fileName, int line);
00214 void parsePSFile(GList *tokens, GString *fileName, int line);
00215 void parsePSPaperSize(GList *tokens, GString *fileName, int line);
00216 void parsePSImageableArea(GList *tokens, GString *fileName, int line);
00217 void parsePSLevel(GList *tokens, GString *fileName, int line);
00218 void parsePSFont(GList *tokens, GString *fileName, int line);
00219 void parsePSFont16(char *cmdName, GList *fontList,
00220 GList *tokens, GString *fileName, int line);
00221 void parseTextEncoding(GList *tokens, GString *fileName, int line);
00222 void parseTextEOL(GList *tokens, GString *fileName, int line);
00223 void parseFontDir(GList *tokens, GString *fileName, int line);
00224 void parseInitialZoom(GList *tokens, GString *fileName, int line);
00225 void parseCommand(char *cmdName, GString **val,
00226 GList *tokens, GString *fileName, int line);
00227 void parseYesNo(char *cmdName, GBool *flag,
00228 GList *tokens, GString *fileName, int line);
00229 GBool parseYesNo2(char *token, GBool *flag);
00230 UnicodeMap *getUnicodeMap2(GString *encodingName);
00231
00232
00233
00234 NameToCharCode *
00235 macRomanReverseMap;
00236
00237
00238
00239 NameToCharCode *
00240 nameToUnicode;
00241 GHash *cidToUnicodes;
00242
00243
00244 GHash *unicodeToUnicodes;
00245
00246 GHash *residentUnicodeMaps;
00247
00248 GHash *unicodeMaps;
00249
00250 GHash *cMapDirs;
00251
00252 GList *toUnicodeDirs;
00253 GHash *displayFonts;
00254
00255 GHash *displayCIDFonts;
00256
00257 GHash *displayNamedCIDFonts;
00258
00259 GString *psFile;
00260 int psPaperWidth;
00261 int psPaperHeight;
00262 int psImageableLLX,
00263 psImageableLLY,
00264 psImageableURX,
00265 psImageableURY;
00266 GBool psCrop;
00267 GBool psExpandSmaller;
00268 GBool psShrinkLarger;
00269 GBool psCenter;
00270 GBool psDuplex;
00271 PSLevel psLevel;
00272 GHash *psFonts;
00273
00274 GList *psNamedFonts16;
00275 GList *psFonts16;
00276 GBool psEmbedType1;
00277 GBool psEmbedTrueType;
00278 GBool psEmbedCIDPostScript;
00279 GBool psEmbedCIDTrueType;
00280 GBool psOPI;
00281 GBool psASCIIHex;
00282 GString *textEncoding;
00283
00284 EndOfLineKind textEOL;
00285
00286 GBool textPageBreaks;
00287 GBool textKeepTinyChars;
00288 GList *fontDirs;
00289 GString *initialZoom;
00290 GBool enableT1lib;
00291 GBool enableFreeType;
00292 GBool antialias;
00293 GString *urlCommand;
00294 GString *movieCommand;
00295 GBool mapNumericCharNames;
00296 GBool printCommands;
00297 GBool errQuiet;
00298
00299 CharCodeToUnicodeCache *cidToUnicodeCache;
00300 CharCodeToUnicodeCache *unicodeToUnicodeCache;
00301 UnicodeMapCache *unicodeMapCache;
00302 CMapCache *cMapCache;
00303
00304 #if MULTITHREADED
00305 GMutex mutex;
00306 GMutex unicodeMapCacheMutex;
00307 GMutex cMapCacheMutex;
00308 #endif
00309 };
00310
00311 #endif