📄 globalparams.cc
字号:
if ((SHGetSpecialFolderPathFunc = (BOOL (__stdcall *)(HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate)) GetProcAddress(shell32Lib, "SHGetSpecialFolderPathA"))) { if (!(*SHGetSpecialFolderPathFunc)(NULL, winFontDir, CSIDL_FONTS, FALSE)) { winFontDir[0] = '\0'; } } }#endif for (i = 0; displayFontTab[i].name; ++i) { fontName = new GString(displayFontTab[i].name); if (getDisplayFont(fontName)) { delete fontName; continue; } fileName = NULL; kind = displayFontT1; // make gcc happy if (dir) { fileName = appendToPath(new GString(dir), displayFontTab[i].t1FileName); kind = displayFontT1; if ((f = fopen(fileName->getCString(), "rb"))) { fclose(f); } else { delete fileName; fileName = NULL; } }#ifdef WIN32 if (!fileName && winFontDir[0] && displayFontTab[i].ttFileName) { fileName = appendToPath(new GString(winFontDir), displayFontTab[i].ttFileName); kind = displayFontTT; if ((f = fopen(fileName->getCString(), "rb"))) { fclose(f); } else { delete fileName; fileName = NULL; } } // SHGetSpecialFolderPath(CSIDL_FONTS) doesn't work on Win 2k Server // or Win2003 Server, or with older versions of shell32.dll, so check // the "standard" directories if (displayFontTab[i].ttFileName) { for (j = 0; !fileName && displayFontDirs[j]; ++j) { fileName = appendToPath(new GString(displayFontDirs[j]), displayFontTab[i].ttFileName); kind = displayFontTT; if ((f = fopen(fileName->getCString(), "rb"))) { fclose(f); } else { delete fileName; fileName = NULL; } } }#else for (j = 0; !fileName && displayFontDirs[j]; ++j) { fileName = appendToPath(new GString(displayFontDirs[j]), displayFontTab[i].t1FileName); kind = displayFontT1; if ((f = fopen(fileName->getCString(), "rb"))) { fclose(f); } else { delete fileName; fileName = NULL; } }#endif if (!fileName) { error(-1, "No display font for '%s'", displayFontTab[i].name); delete fontName; continue; } dfp = new DisplayFontParam(fontName, kind); dfp->t1.fileName = fileName; globalParams->addDisplayFont(dfp); }#ifdef WIN32 if (winFontDir[0]) { winFontList = new WinFontList(winFontDir); }#endif}//------------------------------------------------------------------------// accessors//------------------------------------------------------------------------CharCode GlobalParams::getMacRomanCharCode(char *charName) { // no need to lock - macRomanReverseMap is constant return macRomanReverseMap->lookup(charName);}GString *GlobalParams::getBaseDir() { GString *s; lockGlobalParams; s = baseDir->copy(); unlockGlobalParams; return s;}Unicode GlobalParams::mapNameToUnicode(char *charName) { // no need to lock - nameToUnicode is constant return nameToUnicode->lookup(charName);}UnicodeMap *GlobalParams::getResidentUnicodeMap(GString *encodingName) { UnicodeMap *map; lockGlobalParams; map = (UnicodeMap *)residentUnicodeMaps->lookup(encodingName); unlockGlobalParams; if (map) { map->incRefCnt(); } return map;}FILE *GlobalParams::getUnicodeMapFile(GString *encodingName) { GString *fileName; FILE *f; lockGlobalParams; if ((fileName = (GString *)unicodeMaps->lookup(encodingName))) { f = fopen(fileName->getCString(), "r"); } else { f = NULL; } unlockGlobalParams; return f;}FILE *GlobalParams::findCMapFile(GString *collection, GString *cMapName) { GList *list; GString *dir; GString *fileName; FILE *f; int i; lockGlobalParams; if (!(list = (GList *)cMapDirs->lookup(collection))) { unlockGlobalParams; return NULL; } for (i = 0; i < list->getLength(); ++i) { dir = (GString *)list->get(i); fileName = appendToPath(dir->copy(), cMapName->getCString()); f = fopen(fileName->getCString(), "r"); delete fileName; if (f) { unlockGlobalParams; return f; } } unlockGlobalParams; return NULL;}FILE *GlobalParams::findToUnicodeFile(GString *name) { GString *dir, *fileName; FILE *f; int i; lockGlobalParams; for (i = 0; i < toUnicodeDirs->getLength(); ++i) { dir = (GString *)toUnicodeDirs->get(i); fileName = appendToPath(dir->copy(), name->getCString()); f = fopen(fileName->getCString(), "r"); delete fileName; if (f) { unlockGlobalParams; return f; } } unlockGlobalParams; return NULL;}DisplayFontParam *GlobalParams::getDisplayFont(GString *fontName) { DisplayFontParam *dfp; lockGlobalParams; dfp = (DisplayFontParam *)displayFonts->lookup(fontName);#ifdef WIN32 if (!dfp && winFontList) { dfp = winFontList->find(fontName); }#endif unlockGlobalParams; return dfp;}DisplayFontParam *GlobalParams::getDisplayCIDFont(GString *fontName, GString *collection) { DisplayFontParam *dfp; lockGlobalParams; if (!fontName || !(dfp = (DisplayFontParam *)displayNamedCIDFonts->lookup(fontName))) { dfp = (DisplayFontParam *)displayCIDFonts->lookup(collection); } unlockGlobalParams; return dfp;}GString *GlobalParams::getPSFile() { GString *s; lockGlobalParams; s = psFile ? psFile->copy() : (GString *)NULL; unlockGlobalParams; return s;}int GlobalParams::getPSPaperWidth() { int w; lockGlobalParams; w = psPaperWidth; unlockGlobalParams; return w;}int GlobalParams::getPSPaperHeight() { int h; lockGlobalParams; h = psPaperHeight; unlockGlobalParams; return h;}void GlobalParams::getPSImageableArea(int *llx, int *lly, int *urx, int *ury) { lockGlobalParams; *llx = psImageableLLX; *lly = psImageableLLY; *urx = psImageableURX; *ury = psImageableURY; unlockGlobalParams;}GBool GlobalParams::getPSCrop() { GBool f; lockGlobalParams; f = psCrop; unlockGlobalParams; return f;}GBool GlobalParams::getPSExpandSmaller() { GBool f; lockGlobalParams; f = psExpandSmaller; unlockGlobalParams; return f;}GBool GlobalParams::getPSShrinkLarger() { GBool f; lockGlobalParams; f = psShrinkLarger; unlockGlobalParams; return f;}GBool GlobalParams::getPSCenter() { GBool f; lockGlobalParams; f = psCenter; unlockGlobalParams; return f;}GBool GlobalParams::getPSDuplex() { GBool d; lockGlobalParams; d = psDuplex; unlockGlobalParams; return d;}PSLevel GlobalParams::getPSLevel() { PSLevel level; lockGlobalParams; level = psLevel; unlockGlobalParams; return level;}PSFontParam *GlobalParams::getPSFont(GString *fontName) { PSFontParam *p; lockGlobalParams; p = (PSFontParam *)psFonts->lookup(fontName); unlockGlobalParams; return p;}PSFontParam *GlobalParams::getPSFont16(GString *fontName, GString *collection, int wMode) { PSFontParam *p; int i; lockGlobalParams; p = NULL; if (fontName) { for (i = 0; i < psNamedFonts16->getLength(); ++i) { p = (PSFontParam *)psNamedFonts16->get(i); if (!p->pdfFontName->cmp(fontName) && p->wMode == wMode) { break; } p = NULL; } } if (!p && collection) { for (i = 0; i < psFonts16->getLength(); ++i) { p = (PSFontParam *)psFonts16->get(i); if (!p->pdfFontName->cmp(collection) && p->wMode == wMode) { break; } p = NULL; } } unlockGlobalParams; return p;}GBool GlobalParams::getPSEmbedType1() { GBool e; lockGlobalParams; e = psEmbedType1; unlockGlobalParams; return e;}GBool GlobalParams::getPSEmbedTrueType() { GBool e; lockGlobalParams; e = psEmbedTrueType; unlockGlobalParams; return e;}GBool GlobalParams::getPSEmbedCIDPostScript() { GBool e; lockGlobalParams; e = psEmbedCIDPostScript; unlockGlobalParams; return e;}GBool GlobalParams::getPSEmbedCIDTrueType() { GBool e; lockGlobalParams; e = psEmbedCIDTrueType; unlockGlobalParams; return e;}GBool GlobalParams::getPSPreload() { GBool preload; lockGlobalParams; preload = psPreload; unlockGlobalParams; return preload;}GBool GlobalParams::getPSOPI() { GBool opi; lockGlobalParams; opi = psOPI; unlockGlobalParams; return opi;}GBool GlobalParams::getPSASCIIHex() { GBool ah; lockGlobalParams; ah = psASCIIHex; unlockGlobalParams; return ah;}GString *GlobalParams::getTextEncodingName() { GString *s; lockGlobalParams; s = textEncoding->copy(); unlockGlobalParams; return s;}EndOfLineKind GlobalParams::getTextEOL() { EndOfLineKind eol; lockGlobalParams; eol = textEOL; unlockGlobalParams; return eol;}GBool GlobalParams::getTextPageBreaks() { GBool pageBreaks; lockGlobalParams; pageBreaks = textPageBreaks; unlockGlobalParams; return pageBreaks;}GBool GlobalParams::getTextKeepTinyChars() { GBool tiny; lockGlobalParams; tiny = textKeepTinyChars; unlockGlobalParams; return tiny;}GString *GlobalParams::findFontFile(GString *fontName, char **exts) { GString *dir, *fileName; char **ext; FILE *f; int i; lockGlobalParams; for (i = 0; i < fontDirs->getLength(); ++i) { dir = (GString *)fontDirs->get(i); for (ext = exts; *ext; ++ext) { fileName = appendToPath(dir->copy(), fontName->getCString()); fileName->append(*ext); if ((f = fopen(fileName->getCString(), "rb"))) { fclose(f); unlockGlobalParams; return fileName; } delete fileName; } } unlockGlobalParams; return NULL;}GString *GlobalParams::getInitialZoom() { GString *s; lockGlobalParams; s = initialZoom->copy(); unlockGlobalParams; return s;}GBool GlobalParams::getContinuousView() { GBool f; lockGlobalParams; f = continuousView; unlock
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -