]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/xpdf/xpdf.cc
add GnomePrintJob to EvPrintJob constructor arguments.
[evince.git] / pdf / xpdf / xpdf.cc
index 290cfe9901fbeea96a9b32f92f108c39c62b4214..2705cf653582bff0a7578d8bf454cab3ce745ed5 100644 (file)
@@ -2,7 +2,7 @@
 //
 // xpdf.cc
 //
-// Copyright 1996-2002 Glyph & Cog, LLC
+// Copyright 1996-2003 Glyph & Cog, LLC
 //
 //========================================================================
 
 #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,8 +31,8 @@ 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;
@@ -59,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,
@@ -131,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", "[<PDF-file> [<page> | +<dest>]]", argDesc);
+    }
+    exitCode = 99;
+    goto done0;
+  }
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);
+  globalParams->setupBaseFonts(NULL);
   if (psFileArg[0]) {
     globalParams->setPSFile(psFileArg);
   }
@@ -160,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);
   }
@@ -249,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) {
@@ -290,6 +308,7 @@ int main(int argc, char *argv[]) {
   delete globalParams;
 
   // check for memory leaks
+ done0:
   Object::memCheck(stderr);
   gMemReport(stderr);