|
|
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ |
| |
static struct { | static struct { |
char *name; |
const char *name; |
char *t1FileName; |
const char *t1FileName; |
char *ttFileName; |
const char *ttFileName; |
} displayFontTab[] = { | } displayFontTab[] = { |
{"Courier", "n022003l.pfb", "cour.ttf"}, | {"Courier", "n022003l.pfb", "cour.ttf"}, |
{"Courier-Bold", "n022004l.pfb", "courbd.ttf"}, | {"Courier-Bold", "n022004l.pfb", "courbd.ttf"}, |
|
|
}; | }; |
| |
#ifdef WIN32 | #ifdef WIN32 |
static char *displayFontDirs[] = { |
static const char *displayFontDirs[] = { |
"c:/windows/fonts", | "c:/windows/fonts", |
"c:/winnt/fonts", | "c:/winnt/fonts", |
NULL | NULL |
}; | }; |
#else | #else |
static char *displayFontDirs[] = { |
static const char *displayFontDirs[] = { |
"/usr/share/ghostscript/fonts", | "/usr/share/ghostscript/fonts", |
"/usr/local/share/ghostscript/fonts", | "/usr/local/share/ghostscript/fonts", |
"/usr/share/fonts/default/Type1", | "/usr/share/fonts/default/Type1", |
|
|
GBool bold, italic; | GBool bold, italic; |
| |
static WinFontInfo *make(GString *nameA, GBool boldA, GBool italicA, | static WinFontInfo *make(GString *nameA, GBool boldA, GBool italicA, |
HKEY regKey, char *winFontDir); |
HKEY regKey, const char *winFontDir); |
WinFontInfo(GString *nameA, GBool boldA, GBool italicA, | WinFontInfo(GString *nameA, GBool boldA, GBool italicA, |
GString *fileNameA); | GString *fileNameA); |
virtual ~WinFontInfo(); | virtual ~WinFontInfo(); |
|
|
}; | }; |
| |
WinFontInfo *WinFontInfo::make(GString *nameA, GBool boldA, GBool italicA, | WinFontInfo *WinFontInfo::make(GString *nameA, GBool boldA, GBool italicA, |
HKEY regKey, char *winFontDir) { |
HKEY regKey, const char *winFontDir) { |
GString *regName; | GString *regName; |
GString *fileNameA; | GString *fileNameA; |
char buf[MAX_PATH]; | char buf[MAX_PATH]; |
|
|
class WinFontList { | class WinFontList { |
public: | public: |
| |
WinFontList(char *winFontDirA); |
WinFontList(const char *winFontDirA); |
~WinFontList(); | ~WinFontList(); |
WinFontInfo *find(GString *font); | WinFontInfo *find(GString *font); |
| |
|
|
GList *fonts; // [WinFontInfo] | GList *fonts; // [WinFontInfo] |
HDC dc; // (only used during enumeration) | HDC dc; // (only used during enumeration) |
HKEY regKey; // (only used during enumeration) | HKEY regKey; // (only used during enumeration) |
char *winFontDir; // (only used during enumeration) |
const char *winFontDir; // (only used during enumeration) |
}; | }; |
| |
WinFontList::WinFontList(char *winFontDirA) { |
WinFontList::WinFontList(const char *winFontDirA) { |
OSVERSIONINFO version; | OSVERSIONINFO version; |
char *path; |
const char *path; |
| |
fonts = new GList(); | fonts = new GList(); |
dc = GetDC(NULL); | dc = GetDC(NULL); |
|
|
// KeyBinding | // KeyBinding |
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ |
| |
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, char *cmd0) { |
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, const char *cmd0) { |
code = codeA; | code = codeA; |
mods = modsA; | mods = modsA; |
context = contextA; | context = contextA; |
|
|
} | } |
| |
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, | KeyBinding::KeyBinding(int codeA, int modsA, int contextA, |
char *cmd0, char *cmd1) { |
const char *cmd0, const char *cmd1) { |
code = codeA; | code = codeA; |
mods = modsA; | mods = modsA; |
context = contextA; | context = contextA; |
|
|
class Plugin { | class Plugin { |
public: | public: |
| |
static Plugin *load(char *type, char *name); |
static Plugin *load(const char *type, const char *name); |
~Plugin(); | ~Plugin(); |
| |
private: | private: |
|
|
#endif | #endif |
}; | }; |
| |
Plugin *Plugin::load(char *type, char *name) { |
Plugin *Plugin::load(const char *type, const char *name) { |
GString *path; | GString *path; |
Plugin *plugin; | Plugin *plugin; |
XpdfPluginVecTable *vt; | XpdfPluginVecTable *vt; |
|
|
displayCIDFonts = new GHash(); | displayCIDFonts = new GHash(); |
displayNamedCIDFonts = new GHash(); | displayNamedCIDFonts = new GHash(); |
#if HAVE_PAPER_H | #if HAVE_PAPER_H |
char *paperName; |
const char *paperName; |
const struct paper *paperType; | const struct paper *paperType; |
paperinit(); | paperinit(); |
if ((paperName = systempapername())) { | if ((paperName = systempapername())) { |
|
|
| |
} | } |
| |
GlobalParams::GlobalParams(char *cfgFileName) { |
GlobalParams::GlobalParams(const char *cfgFileName) { |
UnicodeMap *map; | UnicodeMap *map; |
GString *fileName; | GString *fileName; |
FILE *f; | FILE *f; |
|
|
displayCIDFonts = new GHash(); | displayCIDFonts = new GHash(); |
displayNamedCIDFonts = new GHash(); | displayNamedCIDFonts = new GHash(); |
#if HAVE_PAPER_H | #if HAVE_PAPER_H |
char *paperName; |
const char *paperName; |
const struct paper *paperType; | const struct paper *paperType; |
paperinit(); | paperinit(); |
if ((paperName = systempapername())) { | if ((paperName = systempapername())) { |
|
|
} | } |
} | } |
| |
void GlobalParams::parseLine(char *buf, GString *fileName, int line) { |
void GlobalParams::parseLine(const char *buf, GString *fileName, int line) { |
GList *tokens; | GList *tokens; |
GString *cmd, *incFile; | GString *cmd, *incFile; |
char *p1, *p2; | char *p1, *p2; |
|
|
psFonts->add(param->pdfFontName, param); | psFonts->add(param->pdfFontName, param); |
} | } |
| |
void GlobalParams::parsePSFont16(char *cmdName, GList *fontList, |
void GlobalParams::parsePSFont16(const char *cmdName, GList *fontList, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
PSFontParam *param; | PSFontParam *param; |
int wMode; | int wMode; |
|
|
| |
GBool GlobalParams::parseKey(GString *modKeyStr, GString *contextStr, | GBool GlobalParams::parseKey(GString *modKeyStr, GString *contextStr, |
int *code, int *mods, int *context, | int *code, int *mods, int *context, |
char *cmdName, |
const char *cmdName, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
char *p0; |
const char *p0; |
| |
*mods = xpdfKeyModNone; | *mods = xpdfKeyModNone; |
p0 = modKeyStr->getCString(); | p0 = modKeyStr->getCString(); |
|
|
} | } |
#endif | #endif |
| |
void GlobalParams::parseCommand(char *cmdName, GString **val, |
void GlobalParams::parseCommand(const char *cmdName, GString **val, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
if (tokens->getLength() != 2) { | if (tokens->getLength() != 2) { |
error(-1, "Bad '%s' config file command (%s:%d)", | error(-1, "Bad '%s' config file command (%s:%d)", |
|
|
*val = ((GString *)tokens->get(1))->copy(); | *val = ((GString *)tokens->get(1))->copy(); |
} | } |
| |
void GlobalParams::parseYesNo(char *cmdName, GBool *flag, |
void GlobalParams::parseYesNo(const char *cmdName, GBool *flag, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
GString *tok; | GString *tok; |
| |
|
|
} | } |
} | } |
| |
GBool GlobalParams::parseYesNo2(char *token, GBool *flag) { |
GBool GlobalParams::parseYesNo2(const char *token, GBool *flag) { |
if (!strcmp(token, "yes")) { | if (!strcmp(token, "yes")) { |
*flag = gTrue; | *flag = gTrue; |
} else if (!strcmp(token, "no")) { | } else if (!strcmp(token, "no")) { |
|
|
return gTrue; | return gTrue; |
} | } |
| |
void GlobalParams::parseInteger(char *cmdName, int *val, |
void GlobalParams::parseInteger(const char *cmdName, int *val, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
GString *tok; | GString *tok; |
int i; | int i; |
|
|
*val = atoi(tok->getCString()); | *val = atoi(tok->getCString()); |
} | } |
| |
void GlobalParams::parseFloat(char *cmdName, double *val, |
void GlobalParams::parseFloat(const char *cmdName, double *val, |
GList *tokens, GString *fileName, int line) { | GList *tokens, GString *fileName, int line) { |
GString *tok; | GString *tok; |
int i; | int i; |
|
|
| |
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ |
| |
void GlobalParams::setBaseDir(char *dir) { |
void GlobalParams::setBaseDir(const char *dir) { |
delete baseDir; | delete baseDir; |
baseDir = new GString(dir); | baseDir = new GString(dir); |
} | } |
| |
void GlobalParams::setupBaseFonts(char *dir) { |
void GlobalParams::setupBaseFonts(const char *dir) { |
GString *fontName; | GString *fontName; |
GString *fileName; | GString *fileName; |
#ifdef WIN32 | #ifdef WIN32 |
|
|
// accessors | // accessors |
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ |
| |
CharCode GlobalParams::getMacRomanCharCode(char *charName) { |
CharCode GlobalParams::getMacRomanCharCode(const char *charName) { |
// no need to lock - macRomanReverseMap is constant | // no need to lock - macRomanReverseMap is constant |
return macRomanReverseMap->lookup(charName); | return macRomanReverseMap->lookup(charName); |
} | } |
|
|
return s; | return s; |
} | } |
| |
Unicode GlobalParams::mapNameToUnicode(char *charName) { |
Unicode GlobalParams::mapNameToUnicode(const char *charName) { |
// no need to lock - nameToUnicode is constant | // no need to lock - nameToUnicode is constant |
return nameToUnicode->lookup(charName); | return nameToUnicode->lookup(charName); |
} | } |
|
|
return tiny; | return tiny; |
} | } |
| |
GString *GlobalParams::findFontFile(GString *fontName, char **exts) { |
GString *GlobalParams::findFontFile(GString *fontName, const char **exts) { |
GString *dir, *fileName; | GString *dir, *fileName; |
char **ext; |
const char **ext; |
FILE *f; | FILE *f; |
int i; | int i; |
| |
|
|
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
void GlobalParams::setPSFile(char *file) { |
void GlobalParams::setPSFile(const char *file) { |
lockGlobalParams; | lockGlobalParams; |
if (psFile) { | if (psFile) { |
delete psFile; | delete psFile; |
|
|
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
GBool GlobalParams::setPSPaperSize(char *size) { |
GBool GlobalParams::setPSPaperSize(const char *size) { |
lockGlobalParams; | lockGlobalParams; |
if (!strcmp(size, "match")) { | if (!strcmp(size, "match")) { |
psPaperWidth = psPaperHeight = -1; | psPaperWidth = psPaperHeight = -1; |
|
|
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
void GlobalParams::setTextEncoding(char *encodingName) { |
void GlobalParams::setTextEncoding(const char *encodingName) { |
lockGlobalParams; | lockGlobalParams; |
delete textEncoding; | delete textEncoding; |
textEncoding = new GString(encodingName); | textEncoding = new GString(encodingName); |
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
GBool GlobalParams::setTextEOL(char *s) { |
GBool GlobalParams::setTextEOL(const char *s) { |
lockGlobalParams; | lockGlobalParams; |
if (!strcmp(s, "unix")) { | if (!strcmp(s, "unix")) { |
textEOL = eolUnix; | textEOL = eolUnix; |
|
|
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
void GlobalParams::setInitialZoom(char *s) { |
void GlobalParams::setInitialZoom(const char *s) { |
lockGlobalParams; | lockGlobalParams; |
delete initialZoom; | delete initialZoom; |
initialZoom = new GString(s); | initialZoom = new GString(s); |
|
|
unlockGlobalParams; | unlockGlobalParams; |
} | } |
| |
GBool GlobalParams::setEnableT1lib(char *s) { |
GBool GlobalParams::setEnableT1lib(const char *s) { |
GBool ok; | GBool ok; |
| |
lockGlobalParams; | lockGlobalParams; |
|
|
return ok; | return ok; |
} | } |
| |
GBool GlobalParams::setEnableFreeType(char *s) { |
GBool GlobalParams::setEnableFreeType(const char *s) { |
GBool ok; | GBool ok; |
| |
lockGlobalParams; | lockGlobalParams; |
|
|
} | } |
| |
| |
GBool GlobalParams::setAntialias(char *s) { |
GBool GlobalParams::setAntialias(const char *s) { |
GBool ok; | GBool ok; |
| |
lockGlobalParams; | lockGlobalParams; |
|
|
return ok; | return ok; |
} | } |
| |
GBool GlobalParams::setVectorAntialias(char *s) { |
GBool GlobalParams::setVectorAntialias(const char *s) { |
GBool ok; | GBool ok; |
| |
lockGlobalParams; | lockGlobalParams; |
|
|
#endif | #endif |
} | } |
| |
XpdfSecurityHandler *GlobalParams::getSecurityHandler(char *name) { |
XpdfSecurityHandler *GlobalParams::getSecurityHandler(const char *name) { |
#ifdef ENABLE_PLUGINS | #ifdef ENABLE_PLUGINS |
XpdfSecurityHandler *hdlr; | XpdfSecurityHandler *hdlr; |
int i; | int i; |
|
|
// plugins | // plugins |
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ |
| |
GBool GlobalParams::loadPlugin(char *type, char *name) { |
GBool GlobalParams::loadPlugin(const char *type, const char *name) { |
Plugin *plugin; | Plugin *plugin; |
| |
if (!(plugin = Plugin::load(type, name))) { | if (!(plugin = Plugin::load(type, name))) { |