X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FGlobalParams.h;h=1fdef63e11dc843a5b1ccd5a1b9e3f484056fade;hb=refs%2Ftags%2Fxpdf-3-01;hp=b65111091a95d0b4cb418b6da74bec376a0b9dd6;hpb=3df3a8d12d7a516579a4eae276b077c015df0f70;p=swftools.git diff --git a/pdf2swf/xpdf/GlobalParams.h b/pdf2swf/xpdf/GlobalParams.h index b651110..1fdef63 100644 --- a/pdf2swf/xpdf/GlobalParams.h +++ b/pdf2swf/xpdf/GlobalParams.h @@ -2,14 +2,16 @@ // // GlobalParams.h // -// Copyright 2001-2002 Glyph & Cog, LLC +// Copyright 2001-2003 Glyph & Cog, LLC // //======================================================================== #ifndef GLOBALPARAMS_H #define GLOBALPARAMS_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -17,16 +19,21 @@ #include "gtypes.h" #include "CharTypes.h" +#if MULTITHREADED +#include "GMutex.h" +#endif + class GString; class GList; class GHash; class NameToCharCode; class CharCodeToUnicode; -class CIDToUnicodeCache; +class CharCodeToUnicodeCache; class UnicodeMap; class UnicodeMapCache; class CMap; class CMapCache; +struct XpdfSecurityHandler; class GlobalParams; //------------------------------------------------------------------------ @@ -37,11 +44,18 @@ extern GlobalParams *globalParams; //------------------------------------------------------------------------ enum DisplayFontParamKind { - displayFontX, displayFontT1, displayFontTT }; +struct DisplayFontParamT1 { + GString *fileName; +}; + +struct DisplayFontParamTT { + GString *fileName; +}; + class DisplayFontParam { public: @@ -50,31 +64,14 @@ public: // generic CID fonts DisplayFontParamKind kind; union { - struct { - GString *xlfd; - GString *encoding; - } x; - struct { - GString *fileName; - } t1; - struct { - GString *fileName; - } tt; + DisplayFontParamT1 t1; + DisplayFontParamTT tt; }; DisplayFontParam(GString *nameA, DisplayFontParamKind kindA); - DisplayFontParam(char *nameA, char *xlfdA, char *encodingA); ~DisplayFontParam(); }; -// Font rasterizer control. -enum FontRastControl { - fontRastNone, // don't use this rasterizer - fontRastPlain, // use it, without anti-aliasing - fontRastAALow, // use it, with low-level anti-aliasing - fontRastAAHigh // use it, with high-level anti-aliasing -}; - //------------------------------------------------------------------------ class PSFontParam { @@ -123,53 +120,74 @@ public: ~GlobalParams(); + void setBaseDir(char *dir); + void setupBaseFonts(char *dir); + //----- accessors CharCode getMacRomanCharCode(char *charName); + GString *getBaseDir(); Unicode mapNameToUnicode(char *charName); - FILE *getCIDToUnicodeFile(GString *collection); UnicodeMap *getResidentUnicodeMap(GString *encodingName); FILE *getUnicodeMapFile(GString *encodingName); FILE *findCMapFile(GString *collection, GString *cMapName); FILE *findToUnicodeFile(GString *name); DisplayFontParam *getDisplayFont(GString *fontName); DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection); - GString *getPSFile() { return psFile; } - int getPSPaperWidth() { return psPaperWidth; } - int getPSPaperHeight() { return psPaperHeight; } - GBool getPSDuplex() { return psDuplex; } - PSLevel getPSLevel() { return psLevel; } + GString *getPSFile(); + int getPSPaperWidth(); + int getPSPaperHeight(); + void getPSImageableArea(int *llx, int *lly, int *urx, int *ury); + GBool getPSDuplex(); + GBool getPSCrop(); + GBool getPSExpandSmaller(); + GBool getPSShrinkLarger(); + GBool getPSCenter(); + PSLevel getPSLevel(); PSFontParam *getPSFont(GString *fontName); PSFontParam *getPSFont16(GString *fontName, GString *collection, int wMode); - GBool getPSEmbedType1() { return psEmbedType1; } - GBool getPSEmbedTrueType() { return psEmbedTrueType; } - GBool getPSEmbedCIDPostScript() { return psEmbedCIDPostScript; } - GBool getPSEmbedCIDTrueType() { return psEmbedCIDTrueType; } - GBool getPSOPI() { return psOPI; } - GBool getPSASCIIHex() { return psASCIIHex; } - GString *getTextEncodingName() { return textEncoding; } - EndOfLineKind getTextEOL() { return textEOL; } - GString *findFontFile(GString *fontName, char *ext1, char *ext2); - GString *getInitialZoom() { return initialZoom; } - FontRastControl getT1libControl() { return t1libControl; } - FontRastControl getFreeTypeControl() { return freetypeControl; } + GBool getPSEmbedType1(); + GBool getPSEmbedTrueType(); + GBool getPSEmbedCIDPostScript(); + GBool getPSEmbedCIDTrueType(); + GBool getPSOPI(); + GBool getPSASCIIHex(); + GString *getTextEncodingName(); + EndOfLineKind getTextEOL(); + GBool getTextPageBreaks(); + GBool getTextKeepTinyChars(); + GString *findFontFile(GString *fontName, char **exts); + GString *getInitialZoom(); + GBool getContinuousView(); + GBool getEnableT1lib(); + GBool getEnableFreeType(); + GBool getAntialias(); GString *getURLCommand() { return urlCommand; } - GBool getMapNumericCharNames() { return mapNumericCharNames; } - GBool getErrQuiet() { return errQuiet; } + GString *getMovieCommand() { return movieCommand; } + GBool getMapNumericCharNames(); + GBool getPrintCommands(); + GBool getErrQuiet(); CharCodeToUnicode *getCIDToUnicode(GString *collection); + CharCodeToUnicode *getUnicodeToUnicode(GString *fontName); UnicodeMap *getUnicodeMap(GString *encodingName); CMap *getCMap(GString *collection, GString *cMapName); UnicodeMap *getTextEncoding(); //----- functions to set parameters + void addDisplayFont(DisplayFontParam *param); void setPSFile(char *file); GBool setPSPaperSize(char *size); void setPSPaperWidth(int width); void setPSPaperHeight(int height); + void setPSImageableArea(int llx, int lly, int urx, int ury); void setPSDuplex(GBool duplex); + void setPSCrop(GBool crop); + void setPSExpandSmaller(GBool expand); + void setPSShrinkLarger(GBool shrink); + void setPSCenter(GBool center); void setPSLevel(PSLevel level); void setPSEmbedType1(GBool embed); void setPSEmbedTrueType(GBool embed); @@ -179,16 +197,28 @@ public: void setPSASCIIHex(GBool hex); void setTextEncoding(char *encodingName); GBool setTextEOL(char *s); + void setTextPageBreaks(GBool pageBreaks); + void setTextKeepTinyChars(GBool keep); void setInitialZoom(char *s); - GBool setT1libControl(char *s); - GBool setFreeTypeControl(char *s); + void setContinuousView(GBool cont); + GBool setEnableT1lib(char *s); + GBool setEnableFreeType(char *s); + GBool setAntialias(char *s); + void setMapNumericCharNames(GBool map); + void setPrintCommands(GBool printCommandsA); void setErrQuiet(GBool errQuietA); + //----- security handlers + + void addSecurityHandler(XpdfSecurityHandler *handler); + XpdfSecurityHandler *getSecurityHandler(char *name); + private: void parseFile(GString *fileName, FILE *f); void parseNameToUnicode(GList *tokens, GString *fileName, int line); void parseCIDToUnicode(GList *tokens, GString *fileName, int line); + void parseUnicodeToUnicode(GList *tokens, GString *fileName, int line); void parseUnicodeMap(GList *tokens, GString *fileName, int line); void parseCMapDir(GList *tokens, GString *fileName, int line); void parseToUnicodeDir(GList *tokens, GString *fileName, int line); @@ -197,6 +227,7 @@ private: GString *fileName, int line); void parsePSFile(GList *tokens, GString *fileName, int line); void parsePSPaperSize(GList *tokens, GString *fileName, int line); + void parsePSImageableArea(GList *tokens, GString *fileName, int line); void parsePSLevel(GList *tokens, GString *fileName, int line); void parsePSFont(GList *tokens, GString *fileName, int line); void parsePSFont16(char *cmdName, GList *fontList, @@ -205,12 +236,15 @@ private: void parseTextEOL(GList *tokens, GString *fileName, int line); void parseFontDir(GList *tokens, GString *fileName, int line); void parseInitialZoom(GList *tokens, GString *fileName, int line); - void parseFontRastControl(char *cmdName, FontRastControl *val, - GList *tokens, GString *fileName, int line); - void parseURLCommand(GList *tokens, GString *fileName, int line); + void parseCommand(char *cmdName, GString **val, + GList *tokens, GString *fileName, int line); void parseYesNo(char *cmdName, GBool *flag, GList *tokens, GString *fileName, int line); - GBool setFontRastControl(FontRastControl *val, char *s); + GBool parseYesNo2(char *token, GBool *flag); + UnicodeMap *getUnicodeMap2(GString *encodingName); +#ifdef ENABLE_PLUGINS + GBool loadPlugin(char *type, char *name); +#endif //----- static tables @@ -219,11 +253,14 @@ private: //----- user-modifiable settings + GString *baseDir; // base directory - for plugins, etc. NameToCharCode * // mapping from char name to Unicode nameToUnicode; GHash *cidToUnicodes; // files for mappings from char collections // to Unicode, indexed by collection name // [GString] + GHash *unicodeToUnicodes; // files for Unicode-to-Unicode mappings, + // indexed by font name pattern [GString] GHash *residentUnicodeMaps; // mappings from Unicode to char codes, // indexed by encoding name [UnicodeMap] GHash *unicodeMaps; // files for mappings from Unicode to char @@ -240,6 +277,14 @@ private: GString *psFile; // PostScript file or command (for xpdf) int psPaperWidth; // paper size, in PostScript points, for int psPaperHeight; // PostScript output + int psImageableLLX, // imageable area, in PostScript points, + psImageableLLY, // for PostScript output + psImageableURX, + psImageableURY; + GBool psCrop; // crop PS output to CropBox + GBool psExpandSmaller; // expand smaller pages to fill paper + GBool psShrinkLarger; // shrink larger pages to fit paper + GBool psCenter; // center pages on the paper GBool psDuplex; // enable duplexing in PostScript? PSLevel psLevel; // PostScript level to generate GHash *psFonts; // PostScript font info, indexed by PDF @@ -256,18 +301,36 @@ private: // output EndOfLineKind textEOL; // type of EOL marker to use for text // output + GBool textPageBreaks; // insert end-of-page markers? + GBool textKeepTinyChars; // keep all characters in text output GList *fontDirs; // list of font dirs [GString] GString *initialZoom; // initial zoom level - FontRastControl t1libControl; // t1lib rasterization mode - FontRastControl // FreeType rasterization mode - freetypeControl; + GBool continuousView; // continuous view mode + GBool enableT1lib; // t1lib enable flag + GBool enableFreeType; // FreeType enable flag + GBool antialias; // anti-aliasing enable flag GString *urlCommand; // command executed for URL links + GString *movieCommand; // command executed for movie annotations GBool mapNumericCharNames; // map numeric char names (from font subsets)? + GBool printCommands; // print the drawing commands GBool errQuiet; // suppress error messages? - CIDToUnicodeCache *cidToUnicodeCache; + CharCodeToUnicodeCache *cidToUnicodeCache; + CharCodeToUnicodeCache *unicodeToUnicodeCache; UnicodeMapCache *unicodeMapCache; CMapCache *cMapCache; + +#ifdef ENABLE_PLUGINS + GList *plugins; // list of plugins [Plugin] + GList *securityHandlers; // list of loaded security handlers + // [XpdfSecurityHandler] +#endif + +#if MULTITHREADED + GMutex mutex; + GMutex unicodeMapCacheMutex; + GMutex cMapCacheMutex; +#endif }; #endif