"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/GlobalParams.cc" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

GlobalParams.cc  (xpdf-4.01.01):GlobalParams.cc  (xpdf-4.02)
skipping to change at line 17 skipping to change at line 17
//======================================================================== //========================================================================
#include <aconf.h> #include <aconf.h>
#ifdef USE_GCC_PRAGMAS #ifdef USE_GCC_PRAGMAS
#pragma implementation #pragma implementation
#endif #endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#include <time.h>
#ifdef _WIN32 #ifdef _WIN32
# include <shlobj.h> # include <shlobj.h>
#endif #endif
#if HAVE_PAPER_H #if HAVE_PAPER_H
#include <paper.h> #include <paper.h>
#endif #endif
#if HAVE_FONTCONFIG
# include <fontconfig/fontconfig.h>
#endif
#include "gmem.h" #include "gmem.h"
#include "gmempp.h" #include "gmempp.h"
#include "GString.h" #include "GString.h"
#include "GList.h" #include "GList.h"
#include "GHash.h" #include "GHash.h"
#include "gfile.h" #include "gfile.h"
#include "FoFiIdentifier.h" #include "FoFiIdentifier.h"
#include "Error.h" #include "Error.h"
#include "NameToCharCode.h" #include "NameToCharCode.h"
#include "CharCodeToUnicode.h" #include "CharCodeToUnicode.h"
skipping to change at line 87 skipping to change at line 92
const char *macFileName; // may be .dfont, .ttf, or .ttc const char *macFileName; // may be .dfont, .ttf, or .ttc
const char *macFontName; // font name inside .dfont or .ttc const char *macFontName; // font name inside .dfont or .ttc
const char *obliqueFont; // name of font to oblique const char *obliqueFont; // name of font to oblique
double obliqueFactor; // oblique sheer factor double obliqueFactor; // oblique sheer factor
} displayFontTab[] = { } displayFontTab[] = {
{"Courier", "n022003l.pfb", "cour.ttf", "Courier", "Cour ier", NULL, 0}, {"Courier", "n022003l.pfb", "cour.ttf", "Courier", "Cour ier", NULL, 0},
{"Courier-Bold", "n022004l.pfb", "courbd.ttf", "Courier", "Cour ier Bold", NULL, 0}, {"Courier-Bold", "n022004l.pfb", "courbd.ttf", "Courier", "Cour ier Bold", NULL, 0},
{"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf", "Courier", "Cour ier Bold Oblique", "Courier-Bold", 0.212557}, {"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf", "Courier", "Cour ier Bold Oblique", "Courier-Bold", 0.212557},
{"Courier-Oblique", "n022023l.pfb", "couri.ttf", "Courier", "Cour ier Oblique", "Courier", 0.212557}, {"Courier-Oblique", "n022023l.pfb", "couri.ttf", "Courier", "Cour ier Oblique", "Courier", 0.212557},
{"Helvetica", "n019003l.pfb", "arial.ttf", "Helvetica", "Helv etica", NULL, 0}, {"Helvetica", "n019003l.pfb", "arial.ttf", "Helvetica", "Helv etica", NULL, 0},
{"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf", "Helvetica", "Helv etica-Bold", NULL, 0}, {"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf", "Helvetica", "Helv etica Bold", NULL, 0},
{"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf", "Helvetica", "Helv etica Bold Oblique", "Helvetica-Bold", 0.212557}, {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf", "Helvetica", "Helv etica Bold Oblique", "Helvetica-Bold", 0.212557},
{"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf", "Helvetica", "Helv etica Oblique", "Helvetica", 0.212557}, {"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf", "Helvetica", "Helv etica Oblique", "Helvetica", 0.212557},
{"Symbol", "s050000l.pfb", NULL, "Symbol", "Symb ol", NULL, 0}, {"Symbol", "s050000l.pfb", NULL, "Symbol", "Symb ol", NULL, 0},
{"Times-Bold", "n021004l.pfb", "timesbd.ttf", "Times", "Time {"Times-Bold", "n021004l.pfb", "timesbd.ttf", "Times", "Time
s-Bold", NULL, 0}, s Bold", NULL, 0},
{"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf", "Times", "Time {"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf", "Times", "Time
s-BoldItalic", NULL, 0}, s Bold Italic", NULL, 0},
{"Times-Italic", "n021023l.pfb", "timesi.ttf", "Times", "Time {"Times-Italic", "n021023l.pfb", "timesi.ttf", "Times", "Time
s-Italic", NULL, 0}, s Italic", NULL, 0},
{"Times-Roman", "n021003l.pfb", "times.ttf", "Times", "Time {"Times-Roman", "n021003l.pfb", "times.ttf", "Times", "Time
s-Roman", NULL, 0}, s Roman", NULL, 0},
{"ZapfDingbats", "d050000l.pfb", NULL, "ZapfDingbats", "Zapf Dingbats", NULL, 0}, {"ZapfDingbats", "d050000l.pfb", NULL, "ZapfDingbats", "Zapf Dingbats", NULL, 0},
{NULL} {NULL}
}; };
#ifdef _WIN32 #ifdef _WIN32
static const char *displayFontDirs[] = { static const char *displayFontDirs[] = {
"c:/windows/fonts", "c:/windows/fonts",
"c:/winnt/fonts", "c:/winnt/fonts",
NULL NULL
}; };
skipping to change at line 222 skipping to change at line 227
public: public:
SysFontList(); SysFontList();
~SysFontList(); ~SysFontList();
SysFontInfo *find(GString *name); SysFontInfo *find(GString *name);
#ifdef _WIN32 #ifdef _WIN32
void scanWindowsFonts(char *winFontDir); void scanWindowsFonts(char *winFontDir);
#endif #endif
#if HAVE_FONTCONFIG
void scanFontconfigFonts();
#endif
private: private:
#ifdef _WIN32 #ifdef _WIN32
SysFontInfo *makeWindowsFont(char *name, int fontNum, SysFontInfo *makeWindowsFont(char *name, int fontNum,
char *path); char *path);
#endif #endif
GList *fonts; // [SysFontInfo] GList *fonts; // [SysFontInfo]
}; };
skipping to change at line 454 skipping to change at line 463
c = s->getChar(i); c = s->getChar(i);
if (c == ' ' || c == ',' || c == '-') { if (c == ' ' || c == ',' || c == '-') {
s->del(i); s->del(i);
} else { } else {
++i; ++i;
} }
} }
if (!strcasecmp(path + strlen(path) - 4, ".ttc")) { if (!strcasecmp(path + strlen(path) - 4, ".ttc")) {
type = sysFontTTC; type = sysFontTTC;
} else if (!strcasecmp(path + strlen(path) - 4, ".otf")) {
type = sysFontOTF;
} else { } else {
type = sysFontTTF; type = sysFontTTF;
} }
return new SysFontInfo(s, bold, italic, new GString(path), type, fontNum); return new SysFontInfo(s, bold, italic, new GString(path), type, fontNum);
} }
#endif #endif
#if HAVE_FONTCONFIG
void SysFontList::scanFontconfigFonts() {
FcPattern *pattern;
FcObjectSet *objSet;
FcFontSet *fontSet;
char *family, *file, *styleLang, *style;
GString *family2;
SysFontType type;
GBool bold, italic;
char c;
int fontNum, i, j, n;
FcInit();
pattern = FcPatternBuild(NULL,
FC_OUTLINE, FcTypeBool, FcTrue,
FC_SCALABLE, FcTypeBool, FcTrue,
NULL);
objSet = FcObjectSetBuild(FC_FAMILY, FC_STYLE, FC_STYLELANG,
FC_FILE, FC_INDEX, NULL);
fontSet = FcFontList(NULL, pattern, objSet);
FcPatternDestroy(pattern);
FcObjectSetDestroy(objSet);
if (fontSet) {
for (i = 0; i < fontSet->nfont; ++i) {
//--- font file, font type
if (FcPatternGetString(fontSet->fonts[i], FC_FILE, 0,
(FcChar8 **)&file)
!= FcResultMatch) {
continue;
}
n = (int)strlen(file);
if (n > 4 && !strcasecmp(file + n - 4, ".pfa")) {
type = sysFontPFA;
} else if (n > 4 && !strcasecmp(file + n - 4, ".pfb")) {
type = sysFontPFB;
} else if (n > 4 && !strcasecmp(file + n - 4, ".ttf")) {
type = sysFontTTF;
} else if (n > 4 && !strcasecmp(file + n - 4, ".otf")) {
type = sysFontOTF;
} else {
continue;
}
//--- font number
if (FcPatternGetInteger(fontSet->fonts[i], FC_INDEX, 0, &fontNum)
!= FcResultMatch) {
fontNum = 0;
}
//--- font family
if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0,
(FcChar8 **)&family)
!= FcResultMatch) {
continue;
}
//----- normalize the font name
family2 = new GString(family);
j = 0;
while (j < family2->getLength()) {
c = family2->getChar(j);
if (c == ' ' || c == ',' || c == '-') {
family2->del(j);
} else {
++j;
}
}
//--- font style
style = NULL;
for (j = 0;
FcPatternGetString(fontSet->fonts[i], FC_STYLELANG, j,
(FcChar8 **)&styleLang)
== FcResultMatch;
++j) {
if (!strcmp(styleLang, "en")) {
if (FcPatternGetString(fontSet->fonts[i], FC_STYLE, j,
(FcChar8 **)&style)
!= FcResultMatch) {
style = NULL;
}
break;
}
++j;
}
bold = style && strstr(style, "Bold") != NULL;
italic = style && (strstr(style, "Italic") != NULL ||
strstr(style, "Oblique") != NULL);
fonts->append(new SysFontInfo(family2, bold, italic,
new GString(file), type, fontNum));
}
FcFontSetDestroy(fontSet);
}
FcFini();
}
#endif // HAVE_FONTCONFIG
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// KeyBinding // KeyBinding
//------------------------------------------------------------------------ //------------------------------------------------------------------------
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, const 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;
cmds = new GList(); cmds = new GList();
cmds->append(new GString(cmd0)); cmds->append(new GString(cmd0));
skipping to change at line 615 skipping to change at line 729
textEncoding = new GString(defaultTextEncoding); textEncoding = new GString(defaultTextEncoding);
#if defined(_WIN32) #if defined(_WIN32)
textEOL = eolDOS; textEOL = eolDOS;
#else #else
textEOL = eolUnix; textEOL = eolUnix;
#endif #endif
textPageBreaks = gTrue; textPageBreaks = gTrue;
textKeepTinyChars = gTrue; textKeepTinyChars = gTrue;
initialZoom = new GString("125"); initialZoom = new GString("125");
defaultFitZoom = 0; defaultFitZoom = 0;
initialDisplayMode = new GString("continuous");
initialToolbarState = gTrue;
initialSidebarState = gTrue; initialSidebarState = gTrue;
initialSelectMode = new GString("linear");
maxTileWidth = 1500; maxTileWidth = 1500;
maxTileHeight = 1500; maxTileHeight = 1500;
tileCacheSize = 10; tileCacheSize = 10;
workerThreads = 1; workerThreads = 1;
enableFreeType = gTrue; enableFreeType = gTrue;
disableFreeTypeHinting = gFalse; disableFreeTypeHinting = gFalse;
antialias = gTrue; antialias = gTrue;
vectorAntialias = gTrue; vectorAntialias = gTrue;
antialiasPrinting = gFalse; antialiasPrinting = gFalse;
strokeAdjust = strokeAdjustNormal; strokeAdjust = strokeAdjustNormal;
skipping to change at line 640 skipping to change at line 757
screenBlackThreshold = 0.0; screenBlackThreshold = 0.0;
screenWhiteThreshold = 1.0; screenWhiteThreshold = 1.0;
minLineWidth = 0.0; minLineWidth = 0.0;
enablePathSimplification = gFalse; enablePathSimplification = gFalse;
drawAnnotations = gTrue; drawAnnotations = gTrue;
drawFormFields = gTrue; drawFormFields = gTrue;
overprintPreview = gFalse; overprintPreview = gFalse;
paperColor = new GString("#ffffff"); paperColor = new GString("#ffffff");
matteColor = new GString("#808080"); matteColor = new GString("#808080");
fullScreenMatteColor = new GString("#000000"); fullScreenMatteColor = new GString("#000000");
reverseVideoInvertImages = gFalse;
launchCommand = NULL; launchCommand = NULL;
movieCommand = NULL; movieCommand = NULL;
defaultPrinter = NULL; defaultPrinter = NULL;
mapNumericCharNames = gTrue; mapNumericCharNames = gTrue;
mapUnknownCharNames = gFalse; mapUnknownCharNames = gFalse;
mapExtTrueTypeFontsViaUnicode = gTrue; mapExtTrueTypeFontsViaUnicode = gTrue;
droppedFonts = new GHash(gTrue); droppedFonts = new GHash(gTrue);
enableXFA = gTrue; enableXFA = gTrue;
createDefaultKeyBindings(); createDefaultKeyBindings();
popupMenuCmds = new GList(); popupMenuCmds = new GList();
tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state"); tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state");
printCommands = gFalse; printCommands = gFalse;
errQuiet = gFalse; errQuiet = gFalse;
debugLogFile = NULL;
cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize); cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
unicodeToUnicodeCache = unicodeToUnicodeCache =
new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize); new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize);
unicodeMapCache = new UnicodeMapCache(); unicodeMapCache = new UnicodeMapCache();
cMapCache = new CMapCache(); cMapCache = new CMapCache();
// set up the initial nameToUnicode table // set up the initial nameToUnicode table
for (i = 0; nameToUnicodeTab[i].name; ++i) { for (i = 0; nameToUnicodeTab[i].name; ++i) {
nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u); nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u);
skipping to change at line 781 skipping to change at line 900
keyBindings->append(new KeyBinding('-', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('-', xpdfKeyModCtrl,
xpdfKeyContextAny, "zoomOut")); xpdfKeyContextAny, "zoomOut"));
keyBindings->append(new KeyBinding('s', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('s', xpdfKeyModCtrl,
xpdfKeyContextAny, "saveAs")); xpdfKeyContextAny, "saveAs"));
keyBindings->append(new KeyBinding('t', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('t', xpdfKeyModCtrl,
xpdfKeyContextAny, "newTab")); xpdfKeyContextAny, "newTab"));
keyBindings->append(new KeyBinding('n', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('n', xpdfKeyModCtrl,
xpdfKeyContextAny, "newWindow")); xpdfKeyContextAny, "newWindow"));
keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl,
xpdfKeyContextAny, "closeTabOrQuit")); xpdfKeyContextAny, "closeTabOrQuit"));
keyBindings->append(new KeyBinding('l', xpdfKeyModCtrl,
xpdfKeyContextAny,
"toggleFullScreenMode"));
keyBindings->append(new KeyBinding('q', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('q', xpdfKeyModCtrl,
xpdfKeyContextAny, "quit")); xpdfKeyContextAny, "quit"));
keyBindings->append(new KeyBinding(xpdfKeyCodeTab, xpdfKeyModCtrl, keyBindings->append(new KeyBinding(xpdfKeyCodeTab, xpdfKeyModCtrl,
xpdfKeyContextAny, "nextTab")); xpdfKeyContextAny, "nextTab"));
keyBindings->append(new KeyBinding(xpdfKeyCodeTab, keyBindings->append(new KeyBinding(xpdfKeyCodeTab,
xpdfKeyModShift | xpdfKeyModCtrl, xpdfKeyModShift | xpdfKeyModCtrl,
xpdfKeyContextAny, "prevTab")); xpdfKeyContextAny, "prevTab"));
keyBindings->append(new KeyBinding('?', xpdfKeyModCtrl, keyBindings->append(new KeyBinding('?', xpdfKeyModCtrl,
xpdfKeyContextAny, "help")); xpdfKeyContextAny, "help"));
skipping to change at line 1016 skipping to change at line 1138
} else if (!cmd->cmp("textPageBreaks")) { } else if (!cmd->cmp("textPageBreaks")) {
parseYesNo("textPageBreaks", &textPageBreaks, parseYesNo("textPageBreaks", &textPageBreaks,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("textKeepTinyChars")) { } else if (!cmd->cmp("textKeepTinyChars")) {
parseYesNo("textKeepTinyChars", &textKeepTinyChars, parseYesNo("textKeepTinyChars", &textKeepTinyChars,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("initialZoom")) { } else if (!cmd->cmp("initialZoom")) {
parseString("initialZoom", &initialZoom, tokens, fileName, line); parseString("initialZoom", &initialZoom, tokens, fileName, line);
} else if (!cmd->cmp("defaultFitZoom")) { } else if (!cmd->cmp("defaultFitZoom")) {
parseInteger("defaultFitZoom", &defaultFitZoom, tokens, fileName, line); parseInteger("defaultFitZoom", &defaultFitZoom, tokens, fileName, line);
} else if (!cmd->cmp("initialDisplayMode")) {
parseString("initialDisplayMode", &initialDisplayMode,
tokens, fileName, line);
} else if (!cmd->cmp("initialToolbarState")) {
parseYesNo("initialToolbarState", &initialToolbarState,
tokens, fileName, line);
} else if (!cmd->cmp("initialSidebarState")) { } else if (!cmd->cmp("initialSidebarState")) {
parseYesNo("initialSidebarState", &initialSidebarState, parseYesNo("initialSidebarState", &initialSidebarState,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("initialSelectMode")) {
parseString("initialSelectMode", &initialSelectMode,
tokens, fileName, line);
} else if (!cmd->cmp("maxTileWidth")) { } else if (!cmd->cmp("maxTileWidth")) {
parseInteger("maxTileWidth", &maxTileWidth, tokens, fileName, line); parseInteger("maxTileWidth", &maxTileWidth, tokens, fileName, line);
} else if (!cmd->cmp("maxTileHeight")) { } else if (!cmd->cmp("maxTileHeight")) {
parseInteger("maxTileHeight", &maxTileHeight, tokens, fileName, line); parseInteger("maxTileHeight", &maxTileHeight, tokens, fileName, line);
} else if (!cmd->cmp("tileCacheSize")) { } else if (!cmd->cmp("tileCacheSize")) {
parseInteger("tileCacheSize", &tileCacheSize, tokens, fileName, line); parseInteger("tileCacheSize", &tileCacheSize, tokens, fileName, line);
} else if (!cmd->cmp("workerThreads")) { } else if (!cmd->cmp("workerThreads")) {
parseInteger("workerThreads", &workerThreads, tokens, fileName, line); parseInteger("workerThreads", &workerThreads, tokens, fileName, line);
} else if (!cmd->cmp("enableFreeType")) { } else if (!cmd->cmp("enableFreeType")) {
parseYesNo("enableFreeType", &enableFreeType, tokens, fileName, line); parseYesNo("enableFreeType", &enableFreeType, tokens, fileName, line);
skipping to change at line 1080 skipping to change at line 1211
} else if (!cmd->cmp("overprintPreview")) { } else if (!cmd->cmp("overprintPreview")) {
parseYesNo("overprintPreview", &overprintPreview, parseYesNo("overprintPreview", &overprintPreview,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("paperColor")) { } else if (!cmd->cmp("paperColor")) {
parseString("paperColor", &paperColor, tokens, fileName, line); parseString("paperColor", &paperColor, tokens, fileName, line);
} else if (!cmd->cmp("matteColor")) { } else if (!cmd->cmp("matteColor")) {
parseString("matteColor", &matteColor, tokens, fileName, line); parseString("matteColor", &matteColor, tokens, fileName, line);
} else if (!cmd->cmp("fullScreenMatteColor")) { } else if (!cmd->cmp("fullScreenMatteColor")) {
parseString("fullScreenMatteColor", &fullScreenMatteColor, parseString("fullScreenMatteColor", &fullScreenMatteColor,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("reverseVideoInvertImages")) {
parseYesNo("reverseVideoInvertImages", &reverseVideoInvertImages,
tokens, fileName, line);
} else if (!cmd->cmp("launchCommand")) { } else if (!cmd->cmp("launchCommand")) {
parseString("launchCommand", &launchCommand, tokens, fileName, line); parseString("launchCommand", &launchCommand, tokens, fileName, line);
} else if (!cmd->cmp("movieCommand")) { } else if (!cmd->cmp("movieCommand")) {
parseString("movieCommand", &movieCommand, tokens, fileName, line); parseString("movieCommand", &movieCommand, tokens, fileName, line);
} else if (!cmd->cmp("defaultPrinter")) { } else if (!cmd->cmp("defaultPrinter")) {
parseString("defaultPrinter", &defaultPrinter, tokens, fileName, line); parseString("defaultPrinter", &defaultPrinter, tokens, fileName, line);
} else if (!cmd->cmp("mapNumericCharNames")) { } else if (!cmd->cmp("mapNumericCharNames")) {
parseYesNo("mapNumericCharNames", &mapNumericCharNames, parseYesNo("mapNumericCharNames", &mapNumericCharNames,
tokens, fileName, line); tokens, fileName, line);
} else if (!cmd->cmp("mapUnknownCharNames")) { } else if (!cmd->cmp("mapUnknownCharNames")) {
skipping to change at line 1112 skipping to change at line 1246
} else if (!cmd->cmp("unbind")) { } else if (!cmd->cmp("unbind")) {
parseUnbind(tokens, fileName, line); parseUnbind(tokens, fileName, line);
} else if (!cmd->cmp("popupMenuCmd")) { } else if (!cmd->cmp("popupMenuCmd")) {
parsePopupMenuCmd(tokens, fileName, line); parsePopupMenuCmd(tokens, fileName, line);
} else if (!cmd->cmp("tabStateFile")) { } else if (!cmd->cmp("tabStateFile")) {
parseString("tabStateFile", &tabStateFile, tokens, fileName, line); parseString("tabStateFile", &tabStateFile, tokens, fileName, line);
} else if (!cmd->cmp("printCommands")) { } else if (!cmd->cmp("printCommands")) {
parseYesNo("printCommands", &printCommands, tokens, fileName, line); parseYesNo("printCommands", &printCommands, tokens, fileName, line);
} else if (!cmd->cmp("errQuiet")) { } else if (!cmd->cmp("errQuiet")) {
parseYesNo("errQuiet", &errQuiet, tokens, fileName, line); parseYesNo("errQuiet", &errQuiet, tokens, fileName, line);
} else if (!cmd->cmp("debugLogFile")) {
parseString("debugLogFile", &debugLogFile, tokens, fileName, line);
} else { } else {
error(errConfig, -1, "Unknown config file command '{0:t}' ({1:t}:{2:d})", error(errConfig, -1, "Unknown config file command '{0:t}' ({1:t}:{2:d})",
cmd, fileName, line); cmd, fileName, line);
if (!cmd->cmp("displayFontX") || if (!cmd->cmp("displayFontX") ||
!cmd->cmp("displayNamedCIDFontX") || !cmd->cmp("displayNamedCIDFontX") ||
!cmd->cmp("displayCIDFontX")) { !cmd->cmp("displayCIDFontX")) {
error(errConfig, -1, "Xpdf no longer supports X fonts"); error(errConfig, -1, "Xpdf no longer supports X fonts");
} else if (!cmd->cmp("enableT1lib")) { } else if (!cmd->cmp("enableT1lib")) {
error(errConfig, -1, "Xpdf no longer uses t1lib"); error(errConfig, -1, "Xpdf no longer uses t1lib");
} else if (!cmd->cmp("t1libControl") || !cmd->cmp("freetypeControl")) { } else if (!cmd->cmp("t1libControl") || !cmd->cmp("freetypeControl")) {
skipping to change at line 1856 skipping to change at line 1992
deleteGHash(fontFiles, GString); deleteGHash(fontFiles, GString);
deleteGList(fontDirs, GString); deleteGList(fontDirs, GString);
deleteGHash(ccFontFiles, GString); deleteGHash(ccFontFiles, GString);
deleteGHash(base14SysFonts, Base14FontInfo); deleteGHash(base14SysFonts, Base14FontInfo);
delete sysFonts; delete sysFonts;
deleteGHash(psResidentFonts, GString); deleteGHash(psResidentFonts, GString);
deleteGList(psResidentFonts16, PSFontParam16); deleteGList(psResidentFonts16, PSFontParam16);
deleteGList(psResidentFontsCC, PSFontParam16); deleteGList(psResidentFontsCC, PSFontParam16);
delete textEncoding; delete textEncoding;
delete initialZoom; delete initialZoom;
delete initialDisplayMode;
delete initialSelectMode;
if (paperColor) { if (paperColor) {
delete paperColor; delete paperColor;
} }
if (matteColor) { if (matteColor) {
delete matteColor; delete matteColor;
} }
if (fullScreenMatteColor) { if (fullScreenMatteColor) {
delete fullScreenMatteColor; delete fullScreenMatteColor;
} }
if (launchCommand) { if (launchCommand) {
skipping to change at line 1937 skipping to change at line 2075
// "C:\Users\whatever\Windows\Fonts", which doesn't actually // "C:\Users\whatever\Windows\Fonts", which doesn't actually
// contain any fonts -- kill that, so we hit the fallback code // contain any fonts -- kill that, so we hit the fallback code
// below. // below.
for (p = winFontDir; *p; ++p) { for (p = winFontDir; *p; ++p) {
if (!strncasecmp(p, "\\Users\\", 7)) { if (!strncasecmp(p, "\\Users\\", 7)) {
winFontDir[0] = '\0'; winFontDir[0] = '\0';
break; break;
} }
} }
} }
FreeLibrary(shell32Lib);
} }
// if something went wrong, or we're on a Terminal Server, try using // if something went wrong, or we're on a Terminal Server, try using
// %SYSTEMROOT%\Fonts // %SYSTEMROOT%\Fonts
if (!winFontDir[0]) { if (!winFontDir[0]) {
GetSystemWindowsDirectoryA(winFontDir, MAX_PATH - 6); GetSystemWindowsDirectoryA(winFontDir, MAX_PATH - 6);
winFontDir[MAX_PATH - 7] = '\0'; winFontDir[MAX_PATH - 7] = '\0';
i = (int)strlen(winFontDir); i = (int)strlen(winFontDir);
if (winFontDir[i-1] != '\\') { if (winFontDir[i-1] != '\\') {
winFontDir[i++] = '\\'; winFontDir[i++] = '\\';
} }
strcpy(winFontDir + i, "Fonts"); strcpy(winFontDir + i, "Fonts");
} }
} }
#endif #endif
#ifdef __APPLE__
// Apple dfonts and ttc fonts seem to randomly and interchangeably use
// space and hyphen, and sometimes drop the separator entirely.
static GBool macFontNameMatches(GString *name1, const char *name2) {
const char *p1, *p2;
char c1, c2;
p1 = name1->getCString();
p2 = name2;
while (*p1 && *p2) {
c1 = *p1;
c2 = *p2;
if (c2 == ' ') {
// * space or hyphen matches a space in the pattern
// * separators can also be dropped, in which case we move to
// the next char in the pattern
if (c1 == ' ' || c1 == '-') {
++p1;
}
} else {
if (c1 != c2) {
return gFalse;
}
++p1;
}
++p2;
}
if (*p1 || *p2) {
return gFalse;
}
return gTrue;
}
#endif
void GlobalParams::setupBaseFonts(const char *dir) { void GlobalParams::setupBaseFonts(const char *dir) {
GString *fontName; GString *fontName;
GString *fileName; GString *fileName;
int fontNum; int fontNum;
const char *s; const char *s;
Base14FontInfo *base14; Base14FontInfo *base14;
#ifdef _WIN32 #ifdef _WIN32
char winFontDir[MAX_PATH]; char winFontDir[MAX_PATH];
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
skipping to change at line 2030 skipping to change at line 2203
fclose(f); fclose(f);
found = gFalse; found = gFalse;
// for .dfont or .ttc, we need to scan the font list // for .dfont or .ttc, we need to scan the font list
if (j < 2) { if (j < 2) {
if (!dfontFontNames) { if (!dfontFontNames) {
dfontFontNames = dfontFontNames =
FoFiIdentifier::getFontList(fileName->getCString()); FoFiIdentifier::getFontList(fileName->getCString());
} }
if (dfontFontNames) { if (dfontFontNames) {
for (k = 0; k < dfontFontNames->getLength(); ++k) { for (k = 0; k < dfontFontNames->getLength(); ++k) {
if (!((GString *)dfontFontNames->get(k)) if (macFontNameMatches((GString *)dfontFontNames->get(k),
->cmp(displayFontTab[i].macFontName)) { displayFontTab[i].macFontName)) {
fontNum = k; fontNum = k;
found = gTrue; found = gTrue;
break; break;
} }
} }
} }
// for .ttf, we just use the font // for .ttf, we just use the font
} else { } else {
found = gTrue; found = gTrue;
} }
skipping to change at line 2105 skipping to change at line 2278
error(errConfig, -1, "No display font for '{0:s}'", error(errConfig, -1, "No display font for '{0:s}'",
displayFontTab[i].name); displayFontTab[i].name);
} }
} }
} }
#ifdef _WIN32 #ifdef _WIN32
if (winFontDir[0]) { if (winFontDir[0]) {
sysFonts->scanWindowsFonts(winFontDir); sysFonts->scanWindowsFonts(winFontDir);
} }
#endif #endif
#if HAVE_FONTCONFIG
sysFonts->scanFontconfigFonts();
#endif
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// accessors // accessors
//------------------------------------------------------------------------ //------------------------------------------------------------------------
CharCode GlobalParams::getMacRomanCharCode(char *charName) { CharCode GlobalParams::getMacRomanCharCode(char *charName) {
// no need to lock - macRomanReverseMap is constant // no need to lock - macRomanReverseMap is constant
return macRomanReverseMap->lookup(charName); return macRomanReverseMap->lookup(charName);
} }
skipping to change at line 2644 skipping to change at line 2820
int GlobalParams::getDefaultFitZoom() { int GlobalParams::getDefaultFitZoom() {
int z; int z;
lockGlobalParams; lockGlobalParams;
z = defaultFitZoom; z = defaultFitZoom;
unlockGlobalParams; unlockGlobalParams;
return z; return z;
} }
GString *GlobalParams::getInitialDisplayMode() {
GString *s;
lockGlobalParams;
s = initialDisplayMode->copy();
unlockGlobalParams;
return s;
}
GBool GlobalParams::getInitialToolbarState() {
GBool state;
lockGlobalParams;
state = initialToolbarState;
unlockGlobalParams;
return state;
}
GBool GlobalParams::getInitialSidebarState() { GBool GlobalParams::getInitialSidebarState() {
GBool state; GBool state;
lockGlobalParams; lockGlobalParams;
state = initialSidebarState; state = initialSidebarState;
unlockGlobalParams; unlockGlobalParams;
return state; return state;
} }
GString *GlobalParams::getInitialSelectMode() {
GString *s;
lockGlobalParams;
s = initialSelectMode->copy();
unlockGlobalParams;
return s;
}
int GlobalParams::getMaxTileWidth() { int GlobalParams::getMaxTileWidth() {
int w; int w;
lockGlobalParams; lockGlobalParams;
w = maxTileWidth; w = maxTileWidth;
unlockGlobalParams; unlockGlobalParams;
return w; return w;
} }
int GlobalParams::getMaxTileHeight() { int GlobalParams::getMaxTileHeight() {
skipping to change at line 2860 skipping to change at line 3063
GString *GlobalParams::getFullScreenMatteColor() { GString *GlobalParams::getFullScreenMatteColor() {
GString *s; GString *s;
lockGlobalParams; lockGlobalParams;
s = fullScreenMatteColor->copy(); s = fullScreenMatteColor->copy();
unlockGlobalParams; unlockGlobalParams;
return s; return s;
} }
GBool GlobalParams::getReverseVideoInvertImages() {
GBool invert;
lockGlobalParams;
invert = reverseVideoInvertImages;
unlockGlobalParams;
return invert;
}
GString *GlobalParams::getDefaultPrinter() { GString *GlobalParams::getDefaultPrinter() {
GString *s; GString *s;
lockGlobalParams; lockGlobalParams;
s = defaultPrinter ? defaultPrinter->copy() : (GString *)NULL; s = defaultPrinter ? defaultPrinter->copy() : (GString *)NULL;
unlockGlobalParams; unlockGlobalParams;
return s; return s;
} }
GBool GlobalParams::getMapNumericCharNames() { GBool GlobalParams::getMapNumericCharNames() {
skipping to change at line 2986 skipping to change at line 3198
unlockGlobalParams; unlockGlobalParams;
return p; return p;
} }
GBool GlobalParams::getErrQuiet() { GBool GlobalParams::getErrQuiet() {
// no locking -- this function may get called from inside a locked // no locking -- this function may get called from inside a locked
// section // section
return errQuiet; return errQuiet;
} }
GString *GlobalParams::getDebugLogFile() {
return debugLogFile;
}
void GlobalParams::debugLogPrintf(char *fmt, ...) {
GString *path;
FILE *f;
GBool needClose;
time_t t;
struct tm tm;
va_list args;
if (!(path = getDebugLogFile())) {
return;
}
needClose = gFalse;
if (!path->cmp("-")) {
f = stdout;
} else if (!path->cmp("+")) {
f = stderr;
} else {
f = fopen(path->getCString(), "a");
needClose = gTrue;
}
if (!f) {
return;
}
t = time(NULL);
#ifdef _WIN32
localtime_s(&tm, &t);
#else
localtime_r(&t, &tm);
#endif
fprintf(f, "[%04d-%02d-%02d %02d:%02d:%02d] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
va_start(args, fmt);
vfprintf(f, fmt, args);
va_end(args);
fflush(f);
if (needClose) {
fclose(f);
}
}
CharCodeToUnicode *GlobalParams::getCIDToUnicode(GString *collection) { CharCodeToUnicode *GlobalParams::getCIDToUnicode(GString *collection) {
GString *fileName; GString *fileName;
CharCodeToUnicode *ctu; CharCodeToUnicode *ctu;
lockGlobalParams; lockGlobalParams;
if (!(ctu = cidToUnicodeCache->getCharCodeToUnicode(collection))) { if (!(ctu = cidToUnicodeCache->getCharCodeToUnicode(collection))) {
if ((fileName = (GString *)cidToUnicodes->lookup(collection)) && if ((fileName = (GString *)cidToUnicodes->lookup(collection)) &&
(ctu = CharCodeToUnicode::parseCIDToUnicode(fileName, collection))) { (ctu = CharCodeToUnicode::parseCIDToUnicode(fileName, collection))) {
cidToUnicodeCache->add(ctu); cidToUnicodeCache->add(ctu);
} }
 End of changes. 26 change blocks. 
11 lines changed or deleted 268 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)