X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2Fxpdf.cc;h=2705cf653582bff0a7578d8bf454cab3ce745ed5;hb=e0ca7880392b3d064e55406f270e2f68779e3cdc;hp=ef47fb6e5dd067c5140d089158801b7edd56be4b;hpb=64676031423465996e83c4a685290f0c3d97a249;p=evince.git diff --git a/pdf/xpdf/xpdf.cc b/pdf/xpdf/xpdf.cc index ef47fb6e..2705cf65 100644 --- a/pdf/xpdf/xpdf.cc +++ b/pdf/xpdf/xpdf.cc @@ -2,7 +2,7 @@ // // xpdf.cc // -// Copyright 1996-2002 Glyph & Cog, LLC +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== @@ -15,14 +15,15 @@ #include "GlobalParams.h" #include "Object.h" #include "XPDFApp.h" -#include "config.h" +#include "xpdfconfig.h" //------------------------------------------------------------------------ // command line options //------------------------------------------------------------------------ -static char t1libControlStr[16] = ""; -static char freetypeControlStr[16] = ""; +static char enableT1libStr[16] = ""; +static char enableFreeTypeStr[16] = ""; +static char antialiasStr[16] = ""; static char psFileArg[256]; static char paperSize[15] = ""; static int paperWidth = 0; @@ -30,10 +31,11 @@ static int paperHeight = 0; static GBool level1 = gFalse; static char textEncName[128] = ""; static char textEOL[16] = ""; -static char ownerPassword[33] = ""; -static char userPassword[33] = ""; +static char ownerPassword[33] = "\001"; +static char userPassword[33] = "\001"; static GBool fullScreen = gFalse; static char remoteName[100] = "xpdf_"; +static GBool doRemoteReload = gFalse; static GBool doRemoteRaise = gFalse; static GBool doRemoteQuit = gFalse; static GBool printCommands = gFalse; @@ -58,19 +60,21 @@ static ArgDesc argDesc[] = { {"-papercolor", argStringDummy, NULL, 0, "color of paper background"}, {"-z", argStringDummy, NULL, 0, - "initial zoom level (-5..5, page, width)"}, + "initial zoom level (percent, 'page', 'width')"}, #if HAVE_T1LIB_H - {"-t1lib", argString, t1libControlStr, sizeof(t1libControlStr), - "t1lib font rasterizer control: none, plain, low, high"}, + {"-t1lib", argString, enableT1libStr, sizeof(enableT1libStr), + "enable t1lib font rasterizer: yes, no"}, #endif #if HAVE_FREETYPE_FREETYPE_H | HAVE_FREETYPE_H - {"-freetype", argString, freetypeControlStr, sizeof(freetypeControlStr), - "FreeType font rasterizer control: none, plain, low, high"}, + {"-freetype", argString, enableFreeTypeStr, sizeof(enableFreeTypeStr), + "enable FreeType font rasterizer: yes, no"}, #endif + {"-aa", argString, antialiasStr, sizeof(antialiasStr), + "enable font anti-aliasing: yes, no"}, {"-ps", argString, psFileArg, sizeof(psFileArg), "default PostScript file name or command"}, {"-paper", argString, paperSize, sizeof(paperSize), - "paper size (letter, legal, A4, A3)"}, + "paper size (letter, legal, A4, A3, match)"}, {"-paperw", argInt, &paperWidth, 0, "paper width, in points"}, {"-paperh", argInt, &paperHeight, 0, @@ -89,6 +93,8 @@ static ArgDesc argDesc[] = { "run in full-screen (presentation) mode"}, {"-remote", argString, remoteName + 5, sizeof(remoteName) - 5, "start/contact xpdf remote server with specified name"}, + {"-reload", argFlag, &doRemoteReload, 0, + "reload xpdf remove server window (with -remote only)"}, {"-raise", argFlag, &doRemoteRaise, 0, "raise xpdf remote server window (with -remote only)"}, {"-quit", argFlag, &doRemoteQuit, 0, @@ -128,9 +134,19 @@ int main(int argc, char *argv[]) { // parse args ok = parseArgs(argDesc, &argc, argv); + if (!ok || printVersion || printHelp) { + fprintf(stderr, "xpdf version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + if (!printVersion) { + printUsage("xpdf", "[ [ | +]]", argDesc); + } + exitCode = 99; + goto done0; + } // read config file globalParams = new GlobalParams(cfgFileName); + globalParams->setupBaseFonts(NULL); if (psFileArg[0]) { globalParams->setPSFile(psFileArg); } @@ -157,16 +173,21 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Bad '-eol' value on command line\n"); } } - if (t1libControlStr[0]) { - if (!globalParams->setT1libControl(t1libControlStr)) { + if (enableT1libStr[0]) { + if (!globalParams->setEnableT1lib(enableT1libStr)) { fprintf(stderr, "Bad '-t1lib' value on command line\n"); } } - if (freetypeControlStr[0]) { - if (!globalParams->setFreeTypeControl(freetypeControlStr)) { + if (enableFreeTypeStr[0]) { + if (!globalParams->setEnableFreeType(enableFreeTypeStr)) { fprintf(stderr, "Bad '-freetype' value on command line\n"); } } + if (antialiasStr[0]) { + if (!globalParams->setAntialias(antialiasStr)) { + fprintf(stderr, "Bad '-aa' value on command line\n"); + } + } if (printCommands) { globalParams->setPrintCommands(printCommands); } @@ -184,12 +205,15 @@ int main(int argc, char *argv[]) { } // check command line + ok = ok && argc >= 1 && argc <= 3; + if (doRemoteReload) { + ok = ok && remoteName[5] && !doRemoteQuit && argc == 1; + } if (doRemoteRaise) { - ok = ok && remoteName[5] && !doRemoteQuit && argc >= 1 && argc <= 3; - } else if (doRemoteQuit) { + ok = ok && remoteName[5] && !doRemoteQuit; + } + if (doRemoteQuit) { ok = ok && remoteName[5] && argc == 1; - } else { - ok = ok && argc >= 1 && argc <= 3; } if (!ok || printVersion || printHelp) { fprintf(stderr, "xpdf version %s\n", xpdfVersion); @@ -225,6 +249,8 @@ int main(int argc, char *argv[]) { } else { app->remoteOpen(fileName, pg, doRemoteRaise); } + } else if (doRemoteReload) { + app->remoteReload(doRemoteRaise); } else if (doRemoteRaise) { app->remoteRaise(); } else if (doRemoteQuit) { @@ -241,10 +267,10 @@ int main(int argc, char *argv[]) { app->setFullScreen(fullScreen); // check for password string(s) - ownerPasswordStr = ownerPassword[0] ? new GString(ownerPassword) - : (GString *)NULL; - userPasswordStr = userPassword[0] ? new GString(userPassword) - : (GString *)NULL; + ownerPasswordStr = ownerPassword[0] != '\001' ? new GString(ownerPassword) + : (GString *)NULL; + userPasswordStr = userPassword[0] != '\001' ? new GString(userPassword) + : (GString *)NULL; // open the file and run the main loop if (destName) { @@ -282,6 +308,7 @@ int main(int argc, char *argv[]) { delete globalParams; // check for memory leaks + done0: Object::memCheck(stderr); gMemReport(stderr);