parent
9b60889713
commit
3c87903cf0
@ -1,47 +0,0 @@ |
||||
/* aconf.h. Generated by configure. */ |
||||
/*
|
||||
* aconf.h |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF_H |
||||
#define ACONF_H |
||||
|
||||
#include <aconf2.h> |
||||
|
||||
/*
|
||||
* Enable multithreading support. |
||||
*/ |
||||
#define MULTITHREADED 1 |
||||
|
||||
/*
|
||||
* Enable C++ exceptions. |
||||
*/ |
||||
#define USE_EXCEPTIONS 1 |
||||
|
||||
#undef SYSTEM_XPDFRC |
||||
|
||||
/*
|
||||
* Use FreeType 2. |
||||
*/ |
||||
#define HAVE_FREETYPE_FREETYPE_H 1 |
||||
|
||||
/*
|
||||
* Defined if the Splash library is avaiable. |
||||
*/ |
||||
#define HAVE_SPLASH 1 |
||||
|
||||
#define HAVE_DIRENT_H 1 |
||||
#define HAVE_STRINGS_H 1 |
||||
#define HAVE_POPEN 1 |
||||
#define HAVE_MKSTEMP 1 |
||||
|
||||
#ifdef __APPLE__ // Not available on Fedora 9
|
||||
#define HAVE_MKSTEMPS 1 |
||||
#endif |
||||
|
||||
#define HAVE_FSEEKO 1 |
||||
#define HAVE_XTAPPSETEXITFLAG 1 |
||||
#endif |
||||
|
@ -1,38 +0,0 @@ |
||||
/*
|
||||
* aconf2.h |
||||
* |
||||
* This gets included by aconf.h, and contains miscellaneous global |
||||
* settings not directly controlled by autoconf. This is a separate |
||||
* file because otherwise the configure script will munge any |
||||
* #define/#undef constructs. |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF2_H |
||||
#define ACONF2_H |
||||
|
||||
/*
|
||||
* This controls the use of the interface/implementation pragmas. |
||||
*/ |
||||
#ifdef __GNUC__ |
||||
#define USE_GCC_PRAGMAS |
||||
#endif |
||||
/* There is a bug in the version of gcc which ships with MacOS X 10.2 */ |
||||
#if defined(__APPLE__) && defined(__MACH__) |
||||
# include <AvailabilityMacros.h> |
||||
#endif |
||||
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED |
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 |
||||
# undef USE_GCC_PRAGMAS |
||||
# endif |
||||
#endif |
||||
|
||||
/*
|
||||
* Make sure WIN32 is defined if appropriate. |
||||
*/ |
||||
#if defined(_WIN32) && !defined(WIN32) |
||||
# define WIN32 |
||||
#endif |
||||
|
||||
#endif |
@ -1,58 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Array.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef ARRAY_H |
||||
#define ARRAY_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "Object.h" |
||||
|
||||
class XRef; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Array
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class Array { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
Array(XRef *xrefA); |
||||
|
||||
// Destructor.
|
||||
~Array(); |
||||
|
||||
// Reference counting.
|
||||
int incRef() { return ++ref; } |
||||
int decRef() { return --ref; } |
||||
|
||||
// Get number of elements.
|
||||
int getLength() { return length; } |
||||
|
||||
// Add an element.
|
||||
void add(Object *elem); |
||||
|
||||
// Accessors.
|
||||
Object *get(int i, Object *obj); |
||||
Object *getNF(int i, Object *obj); |
||||
|
||||
private: |
||||
|
||||
XRef *xref; // the xref table for this PDF file
|
||||
Object *elems; // array of elements
|
||||
int size; // size of <elems> array
|
||||
int length; // number of elements in array
|
||||
int ref; // reference count
|
||||
}; |
||||
|
||||
#endif |
@ -1,118 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Catalog.h
|
||||
//
|
||||
// Copyright 1996-2007 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef CATALOG_H |
||||
#define CATALOG_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "CharTypes.h" |
||||
|
||||
class GList; |
||||
class PDFDoc; |
||||
class XRef; |
||||
class Object; |
||||
class Page; |
||||
class PageAttrs; |
||||
struct Ref; |
||||
class LinkDest; |
||||
class PageTreeNode; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Catalog
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class Catalog { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
Catalog(PDFDoc *docA); |
||||
|
||||
// Destructor.
|
||||
~Catalog(); |
||||
|
||||
// Is catalog valid?
|
||||
GBool isOk() { return ok; } |
||||
|
||||
// Get number of pages.
|
||||
int getNumPages() { return numPages; } |
||||
|
||||
// Get a page.
|
||||
Page *getPage(int i); |
||||
|
||||
// Get the reference for a page object.
|
||||
Ref *getPageRef(int i); |
||||
|
||||
// Return base URI, or NULL if none.
|
||||
GString *getBaseURI() { return baseURI; } |
||||
|
||||
// Return the contents of the metadata stream, or NULL if there is
|
||||
// no metadata.
|
||||
GString *readMetadata(); |
||||
|
||||
// Return the structure tree root object.
|
||||
Object *getStructTreeRoot() { return &structTreeRoot; } |
||||
|
||||
// Find a page, given its object ID. Returns page number, or 0 if
|
||||
// not found.
|
||||
int findPage(int num, int gen); |
||||
|
||||
// Find a named destination. Returns the link destination, or
|
||||
// NULL if <name> is not a destination.
|
||||
LinkDest *findDest(GString *name); |
||||
|
||||
Object *getDests() { return &dests; } |
||||
|
||||
Object *getNameTree() { return &nameTree; } |
||||
|
||||
Object *getOutline() { return &outline; } |
||||
|
||||
Object *getAcroForm() { return &acroForm; } |
||||
|
||||
Object *getOCProperties() { return &ocProperties; } |
||||
|
||||
// Get the list of embedded files.
|
||||
int getNumEmbeddedFiles(); |
||||
Unicode *getEmbeddedFileName(int idx); |
||||
int getEmbeddedFileNameLength(int idx); |
||||
Object *getEmbeddedFileStreamObj(int idx, Object *strObj); |
||||
|
||||
private: |
||||
|
||||
PDFDoc *doc; |
||||
XRef *xref; // the xref table for this PDF file
|
||||
PageTreeNode *pageTree; // the page tree
|
||||
Page **pages; // array of pages
|
||||
Ref *pageRefs; // object ID for each page
|
||||
int numPages; // number of pages
|
||||
int pagesSize; // size of pages array
|
||||
Object dests; // named destination dictionary
|
||||
Object nameTree; // name tree
|
||||
GString *baseURI; // base URI for URI-type links
|
||||
Object metadata; // metadata stream
|
||||
Object structTreeRoot; // structure tree root dictionary
|
||||
Object outline; // outline dictionary
|
||||
Object acroForm; // AcroForm dictionary
|
||||
Object ocProperties; // OCProperties dictionary
|
||||
GList *embeddedFiles; // embedded file list [EmbeddedFile]
|
||||
GBool ok; // true if catalog is valid
|
||||
|
||||
Object *findDestInTree(Object *tree, GString *name, Object *obj); |
||||
GBool readPageTree(Object *catDict); |
||||
int countPageTree(Object *pagesObj); |
||||
void loadPage(int pg); |
||||
void loadPage2(int pg, int relPg, PageTreeNode *node); |
||||
void readEmbeddedFileList(Dict *catDict); |
||||
void readEmbeddedFileTree(Object *node); |
||||
}; |
||||
|
||||
#endif |
@ -1,24 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// CharTypes.h
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef CHARTYPES_H |
||||
#define CHARTYPES_H |
||||
|
||||
// Unicode character.
|
||||
typedef unsigned int Unicode; |
||||
|
||||
// Character ID for CID character collections.
|
||||
typedef unsigned int CID; |
||||
|
||||
// This is large enough to hold any of the following:
|
||||
// - 8-bit char code
|
||||
// - 16-bit CID
|
||||
// - Unicode
|
||||
typedef unsigned int CharCode; |
||||
|
||||
#endif |
@ -1,77 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Dict.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef DICT_H |
||||
#define DICT_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "Object.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Dict
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
struct DictEntry { |
||||
char *key; |
||||
Object val; |
||||
}; |
||||
|
||||
class Dict { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
Dict(XRef *xrefA); |
||||
|
||||
// Destructor.
|
||||
~Dict(); |
||||
|
||||
// Reference counting.
|
||||
int incRef() { return ++ref; } |
||||
int decRef() { return --ref; } |
||||
|
||||
// Get number of entries.
|
||||
int getLength() { return length; } |
||||
|
||||
// Add an entry. NB: does not copy key.
|
||||
void add(char *key, Object *val); |
||||
|
||||
// Check if dictionary is of specified type.
|
||||
GBool is(char *type); |
||||
|
||||
// Look up an entry and return the value. Returns a null object
|
||||
// if <key> is not in the dictionary.
|
||||
Object *lookup(char *key, Object *obj, int recursion = 0); |
||||
Object *lookupNF(char *key, Object *obj); |
||||
|
||||
// Iterative accessors.
|
||||
char *getKey(int i); |
||||
Object *getVal(int i, Object *obj); |
||||
Object *getValNF(int i, Object *obj); |
||||
|
||||
// Set the xref pointer. This is only used in one special case: the
|
||||
// trailer dictionary, which is read before the xref table is
|
||||
// parsed.
|
||||
void setXRef(XRef *xrefA) { xref = xrefA; } |
||||
|
||||
private: |
||||
|
||||
XRef *xref; // the xref table for this PDF file
|
||||
DictEntry *entries; // array of entries
|
||||
int size; // size of <entries> array
|
||||
int length; // number of entries in dictionary
|
||||
int ref; // reference count
|
||||
|
||||
DictEntry *find(char *key); |
||||
}; |
||||
|
||||
#endif |
@ -1,231 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Function.h
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FUNCTION_H |
||||
#define FUNCTION_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "Object.h" |
||||
|
||||
class Dict; |
||||
class Stream; |
||||
struct PSObject; |
||||
class PSStack; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Function
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#define funcMaxInputs 32 |
||||
#define funcMaxOutputs 32 |
||||
#define sampledFuncMaxInputs 16 |
||||
|
||||
class Function { |
||||
public: |
||||
|
||||
Function(); |
||||
|
||||
virtual ~Function(); |
||||
|
||||
// Construct a function. Returns NULL if unsuccessful.
|
||||
static Function *parse(Object *funcObj, int recursion = 0); |
||||
|
||||
// Initialize the entries common to all function types.
|
||||
GBool init(Dict *dict); |
||||
|
||||
virtual Function *copy() = 0; |
||||
|
||||
// Return the function type:
|
||||
// -1 : identity
|
||||
// 0 : sampled
|
||||
// 2 : exponential
|
||||
// 3 : stitching
|
||||
// 4 : PostScript
|
||||
virtual int getType() = 0; |
||||
|
||||
// Return size of input and output tuples.
|
||||
int getInputSize() { return m; } |
||||
int getOutputSize() { return n; } |
||||
|
||||
double getDomainMin(int i) { return domain[i][0]; } |
||||
double getDomainMax(int i) { return domain[i][1]; } |
||||
double getRangeMin(int i) { return range[i][0]; } |
||||
double getRangeMax(int i) { return range[i][1]; } |
||||
GBool getHasRange() { return hasRange; } |
||||
|
||||
// Transform an input tuple into an output tuple.
|
||||
virtual void transform(double *in, double *out) = 0; |
||||
|
||||
virtual GBool isOk() = 0; |
||||
|
||||
protected: |
||||
|
||||
int m, n; // size of input and output tuples
|
||||
double // min and max values for function domain
|
||||
domain[funcMaxInputs][2]; |
||||
double // min and max values for function range
|
||||
range[funcMaxOutputs][2]; |
||||
GBool hasRange; // set if range is defined
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// IdentityFunction
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class IdentityFunction: public Function { |
||||
public: |
||||
|
||||
IdentityFunction(); |
||||
virtual ~IdentityFunction(); |
||||
virtual Function *copy() { return new IdentityFunction(); } |
||||
virtual int getType() { return -1; } |
||||
virtual void transform(double *in, double *out); |
||||
virtual GBool isOk() { return gTrue; } |
||||
|
||||
private: |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SampledFunction
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class SampledFunction: public Function { |
||||
public: |
||||
|
||||
SampledFunction(Object *funcObj, Dict *dict); |
||||
virtual ~SampledFunction(); |
||||
virtual Function *copy() { return new SampledFunction(this); } |
||||
virtual int getType() { return 0; } |
||||
virtual void transform(double *in, double *out); |
||||
virtual GBool isOk() { return ok; } |
||||
|
||||
int getSampleSize(int i) { return sampleSize[i]; } |
||||
double getEncodeMin(int i) { return encode[i][0]; } |
||||
double getEncodeMax(int i) { return encode[i][1]; } |
||||
double getDecodeMin(int i) { return decode[i][0]; } |
||||
double getDecodeMax(int i) { return decode[i][1]; } |
||||
double *getSamples() { return samples; } |
||||
|
||||
private: |
||||
|
||||
SampledFunction(SampledFunction *func); |
||||
|
||||
int // number of samples for each domain element
|
||||
sampleSize[funcMaxInputs]; |
||||
double // min and max values for domain encoder
|
||||
encode[funcMaxInputs][2]; |
||||
double // min and max values for range decoder
|
||||
decode[funcMaxOutputs][2]; |
||||
double // input multipliers
|
||||
inputMul[funcMaxInputs]; |
||||
int *idxOffset; |
||||
double *samples; // the samples
|
||||
int nSamples; // size of the samples array
|
||||
double *sBuf; // buffer for the transform function
|
||||
double cacheIn[funcMaxInputs]; |
||||
double cacheOut[funcMaxOutputs]; |
||||
GBool ok; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ExponentialFunction
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ExponentialFunction: public Function { |
||||
public: |
||||
|
||||
ExponentialFunction(Object *funcObj, Dict *dict); |
||||
virtual ~ExponentialFunction(); |
||||
virtual Function *copy() { return new ExponentialFunction(this); } |
||||
virtual int getType() { return 2; } |
||||
virtual void transform(double *in, double *out); |
||||
virtual GBool isOk() { return ok; } |
||||
|
||||
double *getC0() { return c0; } |
||||
double *getC1() { return c1; } |
||||
double getE() { return e; } |
||||
|
||||
private: |
||||
|
||||
ExponentialFunction(ExponentialFunction *func); |
||||
|
||||
double c0[funcMaxOutputs]; |
||||
double c1[funcMaxOutputs]; |
||||
double e; |
||||
GBool ok; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// StitchingFunction
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class StitchingFunction: public Function { |
||||
public: |
||||
|
||||
StitchingFunction(Object *funcObj, Dict *dict, int recursion); |
||||
virtual ~StitchingFunction(); |
||||
virtual Function *copy() { return new StitchingFunction(this); } |
||||
virtual int getType() { return 3; } |
||||
virtual void transform(double *in, double *out); |
||||
virtual GBool isOk() { return ok; } |
||||
|
||||
int getNumFuncs() { return k; } |
||||
Function *getFunc(int i) { return funcs[i]; } |
||||
double *getBounds() { return bounds; } |
||||
double *getEncode() { return encode; } |
||||
double *getScale() { return scale; } |
||||
|
||||
private: |
||||
|
||||
StitchingFunction(StitchingFunction *func); |
||||
|
||||
int k; |
||||
Function **funcs; |
||||
double *bounds; |
||||
double *encode; |
||||
double *scale; |
||||
GBool ok; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// PostScriptFunction
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class PostScriptFunction: public Function { |
||||
public: |
||||
|
||||
PostScriptFunction(Object *funcObj, Dict *dict); |
||||
virtual ~PostScriptFunction(); |
||||
virtual Function *copy() { return new PostScriptFunction(this); } |
||||
virtual int getType() { return 4; } |
||||
virtual void transform(double *in, double *out); |
||||
virtual GBool isOk() { return ok; } |
||||
|
||||
GString *getCodeString() { return codeString; } |
||||
|
||||
private: |
||||
|
||||
PostScriptFunction(PostScriptFunction *func); |
||||
GBool parseCode(Stream *str, int *codePtr); |
||||
GString *getToken(Stream *str); |
||||
void resizeCode(int newSize); |
||||
void exec(PSStack *stack, int codePtr); |
||||
|
||||
GString *codeString; |
||||
PSObject *code; |
||||
int codeSize; |
||||
GBool ok; |
||||
}; |
||||
|
||||
#endif |
@ -1,49 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GMutex.h
|
||||
//
|
||||
// Portable mutex macros.
|
||||
//
|
||||
// Copyright 2002-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GMUTEX_H |
||||
#define GMUTEX_H |
||||
|
||||
// Usage:
|
||||
//
|
||||
// GMutex m;
|
||||
// gInitMutex(&m);
|
||||
// ...
|
||||
// gLockMutex(&m);
|
||||
// ... critical section ...
|
||||
// gUnlockMutex(&m);
|
||||
// ...
|
||||
// gDestroyMutex(&m);
|
||||
|
||||
#ifdef WIN32 |
||||
|
||||
#include <windows.h> |
||||
|
||||
typedef CRITICAL_SECTION GMutex; |
||||
|
||||
#define gInitMutex(m) InitializeCriticalSection(m) |
||||
#define gDestroyMutex(m) DeleteCriticalSection(m) |
||||
#define gLockMutex(m) EnterCriticalSection(m) |
||||
#define gUnlockMutex(m) LeaveCriticalSection(m) |
||||
|
||||
#else // assume pthreads
|
||||
|
||||
#include <pthread.h> |
||||
|
||||
typedef pthread_mutex_t GMutex; |
||||
|
||||
#define gInitMutex(m) pthread_mutex_init(m, NULL) |
||||
#define gDestroyMutex(m) pthread_mutex_destroy(m) |
||||
#define gLockMutex(m) pthread_mutex_lock(m) |
||||
#define gUnlockMutex(m) pthread_mutex_unlock(m) |
||||
|
||||
#endif |
||||
|
||||
#endif |
@ -1,136 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GString.h
|
||||
//
|
||||
// Simple variable-length string type.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GSTRING_H |
||||
#define GSTRING_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdarg.h> |
||||
#include "gtypes.h" |
||||
|
||||
class GString { |
||||
public: |
||||
|
||||
// Create an empty string.
|
||||
GString(); |
||||
|
||||
// Create a string from a C string.
|
||||
GString(const char *sA); |
||||
|
||||
// Create a string from <lengthA> chars at <sA>. This string
|
||||
// can contain null characters.
|
||||
GString(const char *sA, int lengthA); |
||||
|
||||
// Create a string from <lengthA> chars at <idx> in <str>.
|
||||
GString(GString *str, int idx, int lengthA); |
||||
|
||||
// Copy a string.
|
||||
GString(GString *str); |
||||
GString *copy() { return new GString(this); } |
||||
|
||||
// Concatenate two strings.
|
||||
GString(GString *str1, GString *str2); |
||||
|
||||
// Convert an integer to a string.
|
||||
static GString *fromInt(int x); |
||||
|
||||
// Create a formatted string. Similar to printf, but without the
|
||||
// string overflow issues. Formatting elements consist of:
|
||||
// {<arg>:[<width>][.<precision>]<type>}
|
||||
// where:
|
||||
// - <arg> is the argument number (arg 0 is the first argument
|
||||
// following the format string) -- NB: args must be first used in
|
||||
// order; they can be reused in any order
|
||||
// - <width> is the field width -- negative to reverse the alignment;
|
||||
// starting with a leading zero to zero-fill (for integers)
|
||||
// - <precision> is the number of digits to the right of the decimal
|
||||
// point (for floating point numbers)
|
||||
// - <type> is one of:
|
||||
// d, x, o, b -- int in decimal, hex, octal, binary
|
||||
// ud, ux, uo, ub -- unsigned int
|
||||
// ld, lx, lo, lb, uld, ulx, ulo, ulb -- long, unsigned long
|
||||
// f, g -- double
|
||||
// c -- char
|
||||
// s -- string (char *)
|
||||
// t -- GString *
|
||||
// w -- blank space; arg determines width
|
||||
// To get literal curly braces, use {{ or }}.
|
||||
static GString *format(const char *fmt, ...); |
||||
static GString *formatv(const char *fmt, va_list argList); |
||||
|
||||
// Destructor.
|
||||
~GString(); |
||||
|
||||
// Get length.
|
||||
int getLength() { return length; } |
||||
|
||||
// Get C string.
|
||||
char *getCString() { return s; } |
||||
|
||||
// Get <i>th character.
|
||||
char getChar(int i) { return s[i]; } |
||||
|
||||
// Change <i>th character.
|
||||
void setChar(int i, char c) { s[i] = c; } |
||||
|
||||
// Clear string to zero length.
|
||||
GString *clear(); |
||||
|
||||
// Append a character or string.
|
||||
GString *append(char c); |
||||
GString *append(GString *str); |
||||
GString *append(const char *str); |
||||
GString *append(const char *str, int lengthA); |
||||
|
||||
// Append a formatted string.
|
||||
GString *appendf(const char *fmt, ...); |
||||
GString *appendfv(const char *fmt, va_list argList); |
||||
|
||||
// Insert a character or string.
|
||||
GString *insert(int i, char c); |
||||
GString *insert(int i, GString *str); |
||||
GString *insert(int i, const char *str); |
||||
GString *insert(int i, const char *str, int lengthA); |
||||
|
||||
// Delete a character or range of characters.
|
||||
GString *del(int i, int n = 1); |
||||
|
||||
// Convert string to all-upper/all-lower case.
|
||||
GString *upperCase(); |
||||
GString *lowerCase(); |
||||
|
||||
// Compare two strings: -1:< 0:= +1:>
|
||||
int cmp(GString *str); |
||||
int cmpN(GString *str, int n); |
||||
int cmp(const char *sA); |
||||
int cmpN(const char *sA, int n); |
||||
|
||||
private: |
||||
|
||||
int length; |
||||
char *s; |
||||
|
||||
void resize(int length1); |
||||
static void formatInt(long x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len); |
||||
static void formatUInt(Gulong x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len); |
||||
static void formatDouble(double x, char *buf, int bufSize, int prec, |
||||
GBool trim, char **p, int *len); |
||||
}; |
||||
|
||||
#endif |
File diff suppressed because it is too large
Load Diff
@ -1,485 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GlobalParams.h
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GLOBALPARAMS_H |
||||
#define GLOBALPARAMS_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include "gtypes.h" |
||||
#include "CharTypes.h" |
||||
|
||||
#if MULTITHREADED |
||||
#include "GMutex.h" |
||||
#endif |
||||
|
||||
class GString; |
||||
class GList; |
||||
class GHash; |
||||
class NameToCharCode; |
||||
class CharCodeToUnicode; |
||||
class CharCodeToUnicodeCache; |
||||
class UnicodeMap; |
||||
class UnicodeMapCache; |
||||
class CMap; |
||||
class CMapCache; |
||||
struct XpdfSecurityHandler; |
||||
class GlobalParams; |
||||
#ifdef WIN32 |
||||
class WinFontList; |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// The global parameters object.
|
||||
extern GlobalParams *globalParams; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum DisplayFontParamKind { |
||||
displayFontT1, |
||||
displayFontTT |
||||
}; |
||||
|
||||
struct DisplayFontParamT1 { |
||||
GString *fileName; |
||||
}; |
||||
|
||||
struct DisplayFontParamTT { |
||||
GString *fileName; |
||||
}; |
||||
|
||||
class DisplayFontParam { |
||||
public: |
||||
|
||||
GString *name; // font name for 8-bit fonts and named
|
||||
// CID fonts; collection name for
|
||||
// generic CID fonts
|
||||
DisplayFontParamKind kind; |
||||
union { |
||||
DisplayFontParamT1 t1; |
||||
DisplayFontParamTT tt; |
||||
}; |
||||
|
||||
DisplayFontParam(GString *nameA, DisplayFontParamKind kindA); |
||||
virtual ~DisplayFontParam(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class PSFontParam { |
||||
public: |
||||
|
||||
GString *pdfFontName; // PDF font name for 8-bit fonts and
|
||||
// named 16-bit fonts; char collection
|
||||
// name for generic 16-bit fonts
|
||||
int wMode; // writing mode (0=horiz, 1=vert) for
|
||||
// 16-bit fonts
|
||||
GString *psFontName; // PostScript font name
|
||||
GString *encoding; // encoding, for 16-bit fonts only
|
||||
|
||||
PSFontParam(GString *pdfFontNameA, int wModeA, |
||||
GString *psFontNameA, GString *encodingA); |
||||
~PSFontParam(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum PSLevel { |
||||
psLevel1, |
||||
psLevel1Sep, |
||||
psLevel2, |
||||
psLevel2Sep, |
||||
psLevel3, |
||||
psLevel3Sep |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum EndOfLineKind { |
||||
eolUnix, // LF
|
||||
eolDOS, // CR+LF
|
||||
eolMac // CR
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum ScreenType { |
||||
screenUnset, |
||||
screenDispersed, |
||||
screenClustered, |
||||
screenStochasticClustered |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class KeyBinding { |
||||
public: |
||||
|
||||
int code; // 0x20 .. 0xfe = ASCII,
|
||||
// >=0x10000 = special keys, mouse buttons,
|
||||
// etc. (xpdfKeyCode* symbols)
|
||||
int mods; // modifiers (xpdfKeyMod* symbols, or-ed
|
||||
// together)
|
||||
int context; // context (xpdfKeyContext* symbols, or-ed
|
||||
// together)
|
||||
GList *cmds; // list of commands [GString]
|
||||
|
||||
KeyBinding(int codeA, int modsA, int contextA, char *cmd0); |
||||
KeyBinding(int codeA, int modsA, int contextA, char *cmd0, char *cmd1); |
||||
KeyBinding(int codeA, int modsA, int contextA, GList *cmdsA); |
||||
~KeyBinding(); |
||||
}; |
||||
|
||||
#define xpdfKeyCodeTab 0x1000 |
||||
#define xpdfKeyCodeReturn 0x1001 |
||||
#define xpdfKeyCodeEnter 0x1002 |
||||
#define xpdfKeyCodeBackspace 0x1003 |
||||
#define xpdfKeyCodeInsert 0x1004 |
||||
#define xpdfKeyCodeDelete 0x1005 |
||||
#define xpdfKeyCodeHome 0x1006 |
||||
#define xpdfKeyCodeEnd 0x1007 |
||||
#define xpdfKeyCodePgUp 0x1008 |
||||
#define xpdfKeyCodePgDn 0x1009 |
||||
#define xpdfKeyCodeLeft 0x100a |
||||
#define xpdfKeyCodeRight 0x100b |
||||
#define xpdfKeyCodeUp 0x100c |
||||
#define xpdfKeyCodeDown 0x100d |
||||
#define xpdfKeyCodeF1 0x1100 |
||||
#define xpdfKeyCodeF35 0x1122 |
||||
#define xpdfKeyCodeMousePress1 0x2001 |
||||
#define xpdfKeyCodeMousePress2 0x2002 |
||||
#define xpdfKeyCodeMousePress3 0x2003 |
||||
#define xpdfKeyCodeMousePress4 0x2004 |
||||
#define xpdfKeyCodeMousePress5 0x2005 |
||||
#define xpdfKeyCodeMousePress6 0x2006 |
||||
#define xpdfKeyCodeMousePress7 0x2007 |
||||
// ...
|
||||
#define xpdfKeyCodeMousePress32 0x2020 |
||||
#define xpdfKeyCodeMouseRelease1 0x2101 |
||||
#define xpdfKeyCodeMouseRelease2 0x2102 |
||||
#define xpdfKeyCodeMouseRelease3 0x2103 |
||||
#define xpdfKeyCodeMouseRelease4 0x2104 |
||||
#define xpdfKeyCodeMouseRelease5 0x2105 |
||||
#define xpdfKeyCodeMouseRelease6 0x2106 |
||||
#define xpdfKeyCodeMouseRelease7 0x2107 |
||||
// ...
|
||||
#define xpdfKeyCodeMouseRelease32 0x2120 |
||||
#define xpdfKeyModNone 0 |
||||
#define xpdfKeyModShift (1 << 0) |
||||
#define xpdfKeyModCtrl (1 << 1) |
||||
#define xpdfKeyModAlt (1 << 2) |
||||
#define xpdfKeyContextAny 0 |
||||
#define xpdfKeyContextFullScreen (1 << 0) |
||||
#define xpdfKeyContextWindow (2 << 0) |
||||
#define xpdfKeyContextContinuous (1 << 2) |
||||
#define xpdfKeyContextSinglePage (2 << 2) |
||||
#define xpdfKeyContextOverLink (1 << 4) |
||||
#define xpdfKeyContextOffLink (2 << 4) |
||||
#define xpdfKeyContextOutline (1 << 6) |
||||
#define xpdfKeyContextMainWin (2 << 6) |
||||
#define xpdfKeyContextScrLockOn (1 << 8) |
||||
#define xpdfKeyContextScrLockOff (2 << 8) |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class GlobalParams { |
||||
public: |
||||
|
||||
// Initialize the global parameters by attempting to read a config
|
||||
// file.
|
||||
GlobalParams(char *cfgFileName); |
||||
|
||||
~GlobalParams(); |
||||
|
||||
void setBaseDir(char *dir); |
||||
void setupBaseFonts(char *dir); |
||||
|
||||
void parseLine(char *buf, GString *fileName, int line); |
||||
|
||||
//----- accessors
|
||||
|
||||
CharCode getMacRomanCharCode(char *charName); |
||||
|
||||
GString *getBaseDir(); |
||||
Unicode mapNameToUnicode(char *charName); |
||||
UnicodeMap *getResidentUnicodeMap(GString *encodingName); |
||||
FILE *getUnicodeMapFile(GString *encodingName); |
||||
FILE *findCMapFile(GString *collection, GString *cMapName); |
||||
FILE *findToUnicodeFile(GString *name); |
||||
DisplayFontParam *getDisplayFont(GString *fontName); |
||||
DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection); |
||||
GString *getPSFile(); |
||||
int getPSPaperWidth(); |
||||
int getPSPaperHeight(); |
||||
void getPSImageableArea(int *llx, int *lly, int *urx, int *ury); |
||||
GBool getPSDuplex(); |
||||
GBool getPSCrop(); |
||||
GBool getPSExpandSmaller(); |
||||
GBool getPSShrinkLarger(); |
||||
GBool getPSCenter(); |
||||
PSLevel getPSLevel(); |
||||
PSFontParam *getPSFont(GString *fontName); |
||||
GList *getPSFontNames(); |
||||
PSFontParam *getPSFont16(GString *fontName, GString *collection, int wMode); |
||||
GBool getPSEmbedType1(); |
||||
GBool getPSEmbedTrueType(); |
||||
GBool getPSEmbedCIDPostScript(); |
||||
GBool getPSEmbedCIDTrueType(); |
||||
GBool getPSFontPassthrough(); |
||||
GBool getPSPreload(); |
||||
GBool getPSOPI(); |
||||
GBool getPSASCIIHex(); |
||||
GBool getPSUncompressPreloadedImages(); |
||||
double getPSRasterResolution(); |
||||
GBool getPSRasterMono(); |
||||
GString *getTextEncodingName(); |
||||
EndOfLineKind getTextEOL(); |
||||
GBool getTextPageBreaks(); |
||||
GBool getTextKeepTinyChars(); |
||||
GString *findFontFile(GString *fontName, char **exts); |
||||
GString *getInitialZoom(); |
||||
GBool getContinuousView(); |
||||
GBool getEnableT1lib(); |
||||
GBool getEnableFreeType(); |
||||
GBool getAntialias(); |
||||
GBool getVectorAntialias(); |
||||
GBool getStrokeAdjust(); |
||||
ScreenType getScreenType(); |
||||
int getScreenSize(); |
||||
int getScreenDotRadius(); |
||||
double getScreenGamma(); |
||||
double getScreenBlackThreshold(); |
||||
double getScreenWhiteThreshold(); |
||||
GBool getDrawAnnotations(); |
||||
GBool getOverprintPreview() { return overprintPreview; } |
||||
GString *getLaunchCommand() { return launchCommand; } |
||||
GString *getURLCommand() { return urlCommand; } |
||||
GString *getMovieCommand() { return movieCommand; } |
||||
GBool getMapNumericCharNames(); |
||||
GBool getMapUnknownCharNames(); |
||||
GList *getKeyBinding(int code, int mods, int context); |
||||
GBool getPrintCommands(); |
||||
GBool getErrQuiet(); |
||||
|
||||
CharCodeToUnicode *getCIDToUnicode(GString *collection); |
||||
CharCodeToUnicode *getUnicodeToUnicode(GString *fontName); |
||||
UnicodeMap *getUnicodeMap(GString *encodingName); |
||||
CMap *getCMap(GString *collection, GString *cMapName); |
||||
UnicodeMap *getTextEncoding(); |
||||
|
||||
//----- functions to set parameters
|
||||
|
||||
void addDisplayFont(DisplayFontParam *param); |
||||
void setPSFile(char *file); |
||||
GBool setPSPaperSize(char *size); |
||||
void setPSPaperWidth(int width); |
||||
void setPSPaperHeight(int height); |
||||
void setPSImageableArea(int llx, int lly, int urx, int ury); |
||||
void setPSDuplex(GBool duplex); |
||||
void setPSCrop(GBool crop); |
||||
void setPSExpandSmaller(GBool expand); |
||||
void setPSShrinkLarger(GBool shrink); |
||||
void setPSCenter(GBool center); |
||||
void setPSLevel(PSLevel level); |
||||
void setPSEmbedType1(GBool embed); |
||||
void setPSEmbedTrueType(GBool embed); |
||||
void setPSEmbedCIDPostScript(GBool embed); |
||||
void setPSEmbedCIDTrueType(GBool embed); |
||||
void setPSFontPassthrough(GBool passthrough); |
||||
void setPSPreload(GBool preload); |
||||
void setPSOPI(GBool opi); |
||||
void setPSASCIIHex(GBool hex); |
||||
void setTextEncoding(char *encodingName); |
||||
GBool setTextEOL(char *s); |
||||
void setTextPageBreaks(GBool pageBreaks); |
||||
void setTextKeepTinyChars(GBool keep); |
||||
void setInitialZoom(char *s); |
||||
void setContinuousView(GBool cont); |
||||
GBool setEnableT1lib(char *s); |
||||
GBool setEnableFreeType(char *s); |
||||
GBool setAntialias(char *s); |
||||
GBool setVectorAntialias(char *s); |
||||
void setScreenType(ScreenType t); |
||||
void setScreenSize(int size); |
||||
void setScreenDotRadius(int r); |
||||
void setScreenGamma(double gamma); |
||||
void setScreenBlackThreshold(double thresh); |
||||
void setScreenWhiteThreshold(double thresh); |
||||
void setMapNumericCharNames(GBool map); |
||||
void setMapUnknownCharNames(GBool map); |
||||
void setPrintCommands(GBool printCommandsA); |
||||
void setErrQuiet(GBool errQuietA); |
||||
|
||||
//----- security handlers
|
||||
|
||||
void addSecurityHandler(XpdfSecurityHandler *handler); |
||||
XpdfSecurityHandler *getSecurityHandler(char *name); |
||||
|
||||
private: |
||||
|
||||
void createDefaultKeyBindings(); |
||||
void parseFile(GString *fileName, FILE *f); |
||||
void parseNameToUnicode(GList *tokens, GString *fileName, int line); |
||||
void parseCIDToUnicode(GList *tokens, GString *fileName, int line); |
||||
void parseUnicodeToUnicode(GList *tokens, GString *fileName, int line); |
||||
void parseUnicodeMap(GList *tokens, GString *fileName, int line); |
||||
void parseCMapDir(GList *tokens, GString *fileName, int line); |
||||
void parseToUnicodeDir(GList *tokens, GString *fileName, int line); |
||||
void parseDisplayFont(GList *tokens, GHash *fontHash, |
||||
DisplayFontParamKind kind, |
||||
GString *fileName, int line); |
||||
void parsePSFile(GList *tokens, GString *fileName, int line); |
||||
void parsePSPaperSize(GList *tokens, GString *fileName, int line); |
||||
void parsePSImageableArea(GList *tokens, GString *fileName, int line); |
||||
void parsePSLevel(GList *tokens, GString *fileName, int line); |
||||
void parsePSFont(GList *tokens, GString *fileName, int line); |
||||
void parsePSFont16(char *cmdName, GList *fontList, |
||||
GList *tokens, GString *fileName, int line); |
||||
void parseTextEncoding(GList *tokens, GString *fileName, int line); |
||||
void parseTextEOL(GList *tokens, GString *fileName, int line); |
||||
void parseFontDir(GList *tokens, GString *fileName, int line); |
||||
void parseInitialZoom(GList *tokens, GString *fileName, int line); |
||||
void parseScreenType(GList *tokens, GString *fileName, int line); |
||||
void parseBind(GList *tokens, GString *fileName, int line); |
||||
void parseUnbind(GList *tokens, GString *fileName, int line); |
||||
GBool parseKey(GString *modKeyStr, GString *contextStr, |
||||
int *code, int *mods, int *context, |
||||
char *cmdName, |
||||
GList *tokens, GString *fileName, int line); |
||||
void parseCommand(char *cmdName, GString **val, |
||||
GList *tokens, GString *fileName, int line); |
||||
void parseYesNo(char *cmdName, GBool *flag, |
||||
GList *tokens, GString *fileName, int line); |
||||
GBool parseYesNo2(char *token, GBool *flag); |
||||
void parseInteger(char *cmdName, int *val, |
||||
GList *tokens, GString *fileName, int line); |
||||
void parseFloat(char *cmdName, double *val, |
||||
GList *tokens, GString *fileName, int line); |
||||
UnicodeMap *getUnicodeMap2(GString *encodingName); |
||||
#ifdef ENABLE_PLUGINS |
||||
GBool loadPlugin(char *type, char *name); |
||||
#endif |
||||
|
||||
//----- static tables
|
||||
|
||||
NameToCharCode * // mapping from char name to
|
||||
macRomanReverseMap; // MacRomanEncoding index
|
||||
|
||||
//----- user-modifiable settings
|
||||
|
||||
GString *baseDir; // base directory - for plugins, etc.
|
||||
NameToCharCode * // mapping from char name to Unicode
|
||||
nameToUnicode; |
||||
GHash *cidToUnicodes; // files for mappings from char collections
|
||||
// to Unicode, indexed by collection name
|
||||
// [GString]
|
||||
GHash *unicodeToUnicodes; // files for Unicode-to-Unicode mappings,
|
||||
// indexed by font name pattern [GString]
|
||||
GHash *residentUnicodeMaps; // mappings from Unicode to char codes,
|
||||
// indexed by encoding name [UnicodeMap]
|
||||
GHash *unicodeMaps; // files for mappings from Unicode to char
|
||||
// codes, indexed by encoding name [GString]
|
||||
GHash *cMapDirs; // list of CMap dirs, indexed by collection
|
||||
// name [GList[GString]]
|
||||
GList *toUnicodeDirs; // list of ToUnicode CMap dirs [GString]
|
||||
GHash *displayFonts; // display font info, indexed by font name
|
||||
// [DisplayFontParam]
|
||||
#ifdef WIN32 |
||||
WinFontList *winFontList; // system TrueType fonts
|
||||
#endif |
||||
GHash *displayCIDFonts; // display CID font info, indexed by
|
||||
// collection [DisplayFontParam]
|
||||
GHash *displayNamedCIDFonts; // display CID font info, indexed by
|
||||
// font name [DisplayFontParam]
|
||||
GString *psFile; // PostScript file or command (for xpdf)
|
||||
int psPaperWidth; // paper size, in PostScript points, for
|
||||
int psPaperHeight; // PostScript output
|
||||
int psImageableLLX, // imageable area, in PostScript points,
|
||||
psImageableLLY, // for PostScript output
|
||||
psImageableURX, |
||||
psImageableURY; |
||||
GBool psCrop; // crop PS output to CropBox
|
||||
GBool psExpandSmaller; // expand smaller pages to fill paper
|
||||
GBool psShrinkLarger; // shrink larger pages to fit paper
|
||||
GBool psCenter; // center pages on the paper
|
||||
GBool psDuplex; // enable duplexing in PostScript?
|
||||
PSLevel psLevel; // PostScript level to generate
|
||||
GHash *psFonts; // PostScript font info, indexed by PDF
|
||||
// font name [PSFontParam]
|
||||
GList *psNamedFonts16; // named 16-bit fonts [PSFontParam]
|
||||
GList *psFonts16; // generic 16-bit fonts [PSFontParam]
|
||||
GBool psEmbedType1; // embed Type 1 fonts?
|
||||
GBool psEmbedTrueType; // embed TrueType fonts?
|
||||
GBool psEmbedCIDPostScript; // embed CID PostScript fonts?
|
||||
GBool psEmbedCIDTrueType; // embed CID TrueType fonts?
|
||||
GBool psFontPassthrough; // pass all fonts through as-is?
|
||||
GBool psPreload; // preload PostScript images and forms into
|
||||
// memory
|
||||
GBool psOPI; // generate PostScript OPI comments?
|
||||
GBool psASCIIHex; // use ASCIIHex instead of ASCII85?
|
||||
GBool psUncompressPreloadedImages; // uncompress all preloaded images
|
||||
double psRasterResolution; // PostScript rasterization resolution (dpi)
|
||||
GBool psRasterMono; // true to do PostScript rasterization
|
||||
// in monochrome (gray); false to do it
|
||||
// in color (RGB/CMYK)
|
||||
GString *textEncoding; // encoding (unicodeMap) to use for text
|
||||
// output
|
||||
EndOfLineKind textEOL; // type of EOL marker to use for text
|
||||
// output
|
||||
GBool textPageBreaks; // insert end-of-page markers?
|
||||
GBool textKeepTinyChars; // keep all characters in text output
|
||||
GList *fontDirs; // list of font dirs [GString]
|
||||
GString *initialZoom; // initial zoom level
|
||||
GBool continuousView; // continuous view mode
|
||||
GBool enableT1lib; // t1lib enable flag
|
||||
GBool enableFreeType; // FreeType enable flag
|
||||
GBool antialias; // font anti-aliasing enable flag
|
||||
GBool vectorAntialias; // vector anti-aliasing enable flag
|
||||
GBool strokeAdjust; // stroke adjustment enable flag
|
||||
ScreenType screenType; // halftone screen type
|
||||
int screenSize; // screen matrix size
|
||||
int screenDotRadius; // screen dot radius
|
||||
double screenGamma; // screen gamma correction
|
||||
double screenBlackThreshold; // screen black clamping threshold
|
||||
double screenWhiteThreshold; // screen white clamping threshold
|
||||
GBool drawAnnotations; // draw annotations or not
|
||||
GBool overprintPreview; // enable overprint preview
|
||||
GString *launchCommand; // command executed for 'launch' links
|
||||
GString *urlCommand; // command executed for URL links
|
||||
GString *movieCommand; // command executed for movie annotations
|
||||
GBool mapNumericCharNames; // map numeric char names (from font subsets)?
|
||||
GBool mapUnknownCharNames; // map unknown char names?
|
||||
GList *keyBindings; // key & mouse button bindings [KeyBinding]
|
||||
GBool printCommands; // print the drawing commands
|
||||
GBool errQuiet; // suppress error messages?
|
||||
|
||||
CharCodeToUnicodeCache *cidToUnicodeCache; |
||||
CharCodeToUnicodeCache *unicodeToUnicodeCache; |
||||
UnicodeMapCache *unicodeMapCache; |
||||
CMapCache *cMapCache; |
||||
|
||||
#ifdef ENABLE_PLUGINS |
||||
GList *plugins; // list of plugins [Plugin]
|
||||
GList *securityHandlers; // list of loaded security handlers
|
||||
// [XpdfSecurityHandler]
|
||||
#endif |
||||
|
||||
#if MULTITHREADED |
||||
GMutex mutex; |
||||
GMutex unicodeMapCacheMutex; |
||||
GMutex cMapCacheMutex; |
||||
#endif |
||||
}; |
||||
|
||||
#endif |
@ -1,303 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Object.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef OBJECT_H |
||||
#define OBJECT_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include "gtypes.h" |
||||
#include "gmem.h" |
||||
#include "GString.h" |
||||
|
||||
class XRef; |
||||
class Array; |
||||
class Dict; |
||||
class Stream; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Ref
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
struct Ref { |
||||
int num; // object number
|
||||
int gen; // generation number
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// object types
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum ObjType { |
||||
// simple objects
|
||||
objBool, // boolean
|
||||
objInt, // integer
|
||||
objReal, // real
|
||||
objString, // string
|
||||
objName, // name
|
||||
objNull, // null
|
||||
|
||||
// complex objects
|
||||
objArray, // array
|
||||
objDict, // dictionary
|
||||
objStream, // stream
|
||||
objRef, // indirect reference
|
||||
|
||||
// special objects
|
||||
objCmd, // command name
|
||||
objError, // error return from Lexer
|
||||
objEOF, // end of file return from Lexer
|
||||
objNone // uninitialized object
|
||||
}; |
||||
|
||||
#define numObjTypes 14 // total number of object types
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Object
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#ifdef DEBUG_MEM |
||||
#define initObj(t) ++numAlloc[type = t] |
||||
#else |
||||
#define initObj(t) type = t |
||||
#endif |
||||
|
||||
class Object { |
||||
public: |
||||
|
||||
// Default constructor.
|
||||
Object(): |
||||
type(objNone) {} |
||||
|
||||
// Initialize an object.
|
||||
Object *initBool(GBool boolnA) |
||||
{ initObj(objBool); booln = boolnA; return this; } |
||||
Object *initInt(int intgA) |
||||
{ initObj(objInt); intg = intgA; return this; } |
||||
Object *initReal(double realA) |
||||
{ initObj(objReal); real = realA; return this; } |
||||
Object *initString(GString *stringA) |
||||
{ initObj(objString); string = stringA; return this; } |
||||
Object *initName(char *nameA) |
||||
{ initObj(objName); name = copyString(nameA); return this; } |
||||
Object *initNull() |
||||
{ initObj(objNull); return this; } |
||||
Object *initArray(XRef *xref); |
||||
Object *initDict(XRef *xref); |
||||
Object *initDict(Dict *dictA); |
||||
Object *initStream(Stream *streamA); |
||||
Object *initRef(int numA, int genA) |
||||
{ initObj(objRef); ref.num = numA; ref.gen = genA; return this; } |
||||
Object *initCmd(char *cmdA) |
||||
{ initObj(objCmd); cmd = copyString(cmdA); return this; } |
||||
Object *initError() |
||||
{ initObj(objError); return this; } |
||||
Object *initEOF() |
||||
{ initObj(objEOF); return this; } |
||||
|
||||
// Copy an object.
|
||||
Object *copy(Object *obj); |
||||
|
||||
// If object is a Ref, fetch and return the referenced object.
|
||||
// Otherwise, return a copy of the object.
|
||||
Object *fetch(XRef *xref, Object *obj, int recursion = 0); |
||||
|
||||
// Free object contents.
|
||||
void free(); |
||||
|
||||
// Type checking.
|
||||
ObjType getType() { return type; } |
||||
GBool isBool() { return type == objBool; } |
||||
GBool isInt() { return type == objInt; } |
||||
GBool isReal() { return type == objReal; } |
||||
GBool isNum() { return type == objInt || type == objReal; } |
||||
GBool isString() { return type == objString; } |
||||
GBool isName() { return type == objName; } |
||||
GBool isNull() { return type == objNull; } |
||||
GBool isArray() { return type == objArray; } |
||||
GBool isDict() { return type == objDict; } |
||||
GBool isStream() { return type == objStream; } |
||||
GBool isRef() { return type == objRef; } |
||||
GBool isCmd() { return type == objCmd; } |
||||
GBool isError() { return type == objError; } |
||||
GBool isEOF() { return type == objEOF; } |
||||
GBool isNone() { return type == objNone; } |
||||
|
||||
// Special type checking.
|
||||
GBool isName(char *nameA) |
||||
{ return type == objName && !strcmp(name, nameA); } |
||||
GBool isDict(char *dictType); |
||||
GBool isStream(char *dictType); |
||||
GBool isCmd(char *cmdA) |
||||
{ return type == objCmd && !strcmp(cmd, cmdA); } |
||||
|
||||
// Accessors. NB: these assume object is of correct type.
|
||||
GBool getBool() { return booln; } |
||||
int getInt() { return intg; } |
||||
double getReal() { return real; } |
||||
double getNum() { return type == objInt ? (double)intg : real; } |
||||
GString *getString() { return string; } |
||||
char *getName() { return name; } |
||||
Array *getArray() { return array; } |
||||
Dict *getDict() { return dict; } |
||||
Stream *getStream() { return stream; } |
||||
Ref getRef() { return ref; } |
||||
int getRefNum() { return ref.num; } |
||||
int getRefGen() { return ref.gen; } |
||||
char *getCmd() { return cmd; } |
||||
|
||||
// Array accessors.
|
||||
int arrayGetLength(); |
||||
void arrayAdd(Object *elem); |
||||
Object *arrayGet(int i, Object *obj); |
||||
Object *arrayGetNF(int i, Object *obj); |
||||
|
||||
// Dict accessors.
|
||||
int dictGetLength(); |
||||
void dictAdd(char *key, Object *val); |
||||
GBool dictIs(char *dictType); |
||||
Object *dictLookup(char *key, Object *obj, int recursion = 0); |
||||
Object *dictLookupNF(char *key, Object *obj); |
||||
char *dictGetKey(int i); |
||||
Object *dictGetVal(int i, Object *obj); |
||||
Object *dictGetValNF(int i, Object *obj); |
||||
|
||||
// Stream accessors.
|
||||
GBool streamIs(char *dictType); |
||||
void streamReset(); |
||||
void streamClose(); |
||||
int streamGetChar(); |
||||
int streamLookChar(); |
||||
char *streamGetLine(char *buf, int size); |
||||
Guint streamGetPos(); |
||||
void streamSetPos(Guint pos, int dir = 0); |
||||
Dict *streamGetDict(); |
||||
|
||||
// Output.
|
||||
char *getTypeName(); |
||||
void print(FILE *f = stdout); |
||||
|
||||
// Memory testing.
|
||||
static void memCheck(FILE *f); |
||||
|
||||
private: |
||||
|
||||
ObjType type; // object type
|
||||
union { // value for each type:
|
||||
GBool booln; // boolean
|
||||
int intg; // integer
|
||||
double real; // real
|
||||
GString *string; // string
|
||||
char *name; // name
|
||||
Array *array; // array
|
||||
Dict *dict; // dictionary
|
||||
Stream *stream; // stream
|
||||
Ref ref; // indirect reference
|
||||
char *cmd; // command
|
||||
}; |
||||
|
||||
#ifdef DEBUG_MEM |
||||
static int // number of each type of object
|
||||
numAlloc[numObjTypes]; // currently allocated
|
||||
#endif |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Array accessors.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#include "Array.h" |
||||
|
||||
inline int Object::arrayGetLength() |
||||
{ return array->getLength(); } |
||||
|
||||
inline void Object::arrayAdd(Object *elem) |
||||
{ array->add(elem); } |
||||
|
||||
inline Object *Object::arrayGet(int i, Object *obj) |
||||
{ return array->get(i, obj); } |
||||
|
||||
inline Object *Object::arrayGetNF(int i, Object *obj) |
||||
{ return array->getNF(i, obj); } |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Dict accessors.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#include "Dict.h" |
||||
|
||||
inline int Object::dictGetLength() |
||||
{ return dict->getLength(); } |
||||
|
||||
inline void Object::dictAdd(char *key, Object *val) |
||||
{ dict->add(key, val); } |
||||
|
||||
inline GBool Object::dictIs(char *dictType) |
||||
{ return dict->is(dictType); } |
||||
|
||||
inline GBool Object::isDict(char *dictType) |
||||
{ return type == objDict && dictIs(dictType); } |
||||
|
||||
inline Object *Object::dictLookup(char *key, Object *obj, int recursion) |
||||
{ return dict->lookup(key, obj, recursion); } |
||||
|
||||
inline Object *Object::dictLookupNF(char *key, Object *obj) |
||||
{ return dict->lookupNF(key, obj); } |
||||
|
||||
inline char *Object::dictGetKey(int i) |
||||
{ return dict->getKey(i); } |
||||
|
||||
inline Object *Object::dictGetVal(int i, Object *obj) |
||||
{ return dict->getVal(i, obj); } |
||||
|
||||
inline Object *Object::dictGetValNF(int i, Object *obj) |
||||
{ return dict->getValNF(i, obj); } |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Stream accessors.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#include "Stream.h" |
||||
|
||||
inline GBool Object::streamIs(char *dictType) |
||||
{ return stream->getDict()->is(dictType); } |
||||
|
||||
inline GBool Object::isStream(char *dictType) |
||||
{ return type == objStream && streamIs(dictType); } |
||||
|
||||
inline void Object::streamReset() |
||||
{ stream->reset(); } |
||||
|
||||
inline void Object::streamClose() |
||||
{ stream->close(); } |
||||
|
||||
inline int Object::streamGetChar() |
||||
{ return stream->getChar(); } |
||||
|
||||
inline int Object::streamLookChar() |
||||
{ return stream->lookChar(); } |
||||
|
||||
inline char *Object::streamGetLine(char *buf, int size) |
||||
{ return stream->getLine(buf, size); } |
||||
|
||||
inline Guint Object::streamGetPos() |
||||
{ return stream->getPos(); } |
||||
|
||||
inline void Object::streamSetPos(Guint pos, int dir) |
||||
{ stream->setPos(pos, dir); } |
||||
|
||||
inline Dict *Object::streamGetDict() |
||||
{ return stream->getDict(); } |
||||
|
||||
#endif |
@ -1,263 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// OutputDev.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef OUTPUTDEV_H |
||||
#define OUTPUTDEV_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "CharTypes.h" |
||||
|
||||
class GString; |
||||
class Gfx; |
||||
class GfxState; |
||||
struct GfxColor; |
||||
class GfxColorSpace; |
||||
class GfxImageColorMap; |
||||
class GfxFunctionShading; |
||||
class GfxAxialShading; |
||||
class GfxRadialShading; |
||||
class Stream; |
||||
class Links; |
||||
class Link; |
||||
class Catalog; |
||||
class Page; |
||||
class Function; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// OutputDev
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class OutputDev { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
OutputDev() {} |
||||
|
||||
// Destructor.
|
||||
virtual ~OutputDev() {} |
||||
|
||||
//----- get info about output device
|
||||
|
||||
// Does this device use upside-down coordinates?
|
||||
// (Upside-down means (0,0) is the top left corner of the page.)
|
||||
virtual GBool upsideDown() = 0; |
||||
|
||||
// Does this device use drawChar() or drawString()?
|
||||
virtual GBool useDrawChar() = 0; |
||||
|
||||
// Does this device use tilingPatternFill()? If this returns false,
|
||||
// tiling pattern fills will be reduced to a series of other drawing
|
||||
// operations.
|
||||
virtual GBool useTilingPatternFill() { return gFalse; } |
||||
|
||||
// Does this device use functionShadedFill(), axialShadedFill(), and
|
||||
// radialShadedFill()? If this returns false, these shaded fills
|
||||
// will be reduced to a series of other drawing operations.
|
||||
virtual GBool useShadedFills() { return gFalse; } |
||||
|
||||
// Does this device use drawForm()? If this returns false,
|
||||
// form-type XObjects will be interpreted (i.e., unrolled).
|
||||
virtual GBool useDrawForm() { return gFalse; } |
||||
|
||||
// Does this device use beginType3Char/endType3Char? Otherwise,
|
||||
// text in Type 3 fonts will be drawn with drawChar/drawString.
|
||||
virtual GBool interpretType3Chars() = 0; |
||||
|
||||
// Does this device need non-text content?
|
||||
virtual GBool needNonText() { return gTrue; } |
||||
|
||||
// Does this device require incCharCount to be called for text on
|
||||
// non-shown layers?
|
||||
virtual GBool needCharCount() { return gFalse; } |
||||
|
||||
|
||||
//----- initialization and control
|
||||
|
||||
// Set default transform matrix.
|
||||
virtual void setDefaultCTM(double *ctm); |
||||
|
||||
// Check to see if a page slice should be displayed. If this
|
||||
// returns false, the page display is aborted. Typically, an
|
||||
// OutputDev will use some alternate means to display the page
|
||||
// before returning false.
|
||||
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI, |
||||
int rotate, GBool useMediaBox, GBool crop, |
||||
int sliceX, int sliceY, int sliceW, int sliceH, |
||||
GBool printing, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL) |
||||
{ return gTrue; } |
||||
|
||||
// Start a page.
|
||||
virtual void startPage(int pageNum, GfxState *state) {} |
||||
|
||||
// End a page.
|
||||
virtual void endPage() {} |
||||
|
||||
// Dump page contents to display.
|
||||
virtual void dump() {} |
||||
|
||||
//----- coordinate conversion
|
||||
|
||||
// Convert between device and user coordinates.
|
||||
virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy); |
||||
virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy); |
||||
|
||||
double *getDefCTM() { return defCTM; } |
||||
double *getDefICTM() { return defICTM; } |
||||
|
||||
//----- save/restore graphics state
|
||||
virtual void saveState(GfxState *state) {} |
||||
virtual void restoreState(GfxState *state) {} |
||||
|
||||
//----- update graphics state
|
||||
virtual void updateAll(GfxState *state); |
||||
virtual void updateCTM(GfxState *state, double m11, double m12, |
||||
double m21, double m22, double m31, double m32) {} |
||||
virtual void updateLineDash(GfxState *state) {} |
||||
virtual void updateFlatness(GfxState *state) {} |
||||
virtual void updateLineJoin(GfxState *state) {} |
||||
virtual void updateLineCap(GfxState *state) {} |
||||
virtual void updateMiterLimit(GfxState *state) {} |
||||
virtual void updateLineWidth(GfxState *state) {} |
||||
virtual void updateStrokeAdjust(GfxState *state) {} |
||||
virtual void updateFillColorSpace(GfxState *state) {} |
||||
virtual void updateStrokeColorSpace(GfxState *state) {} |
||||
virtual void updateFillColor(GfxState *state) {} |
||||
virtual void updateStrokeColor(GfxState *state) {} |
||||
virtual void updateBlendMode(GfxState *state) {} |
||||
virtual void updateFillOpacity(GfxState *state) {} |
||||
virtual void updateStrokeOpacity(GfxState *state) {} |
||||
virtual void updateFillOverprint(GfxState *state) {} |
||||
virtual void updateStrokeOverprint(GfxState *state) {} |
||||
virtual void updateOverprintMode(GfxState *state) {} |
||||
virtual void updateTransfer(GfxState *state) {} |
||||
|
||||
//----- update text state
|
||||
virtual void updateFont(GfxState *state) {} |
||||
virtual void updateTextMat(GfxState *state) {} |
||||
virtual void updateCharSpace(GfxState *state) {} |
||||
virtual void updateRender(GfxState *state) {} |
||||
virtual void updateRise(GfxState *state) {} |
||||
virtual void updateWordSpace(GfxState *state) {} |
||||
virtual void updateHorizScaling(GfxState *state) {} |
||||
virtual void updateTextPos(GfxState *state) {} |
||||
virtual void updateTextShift(GfxState *state, double shift) {} |
||||
virtual void saveTextPos(GfxState *state) {} |
||||
virtual void restoreTextPos(GfxState *state) {} |
||||
|
||||
//----- path painting
|
||||
virtual void stroke(GfxState *state) {} |
||||
virtual void fill(GfxState *state) {} |
||||
virtual void eoFill(GfxState *state) {} |
||||
virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, |
||||
int paintType, Dict *resDict, |
||||
double *mat, double *bbox, |
||||
int x0, int y0, int x1, int y1, |
||||
double xStep, double yStep) {} |
||||
virtual GBool functionShadedFill(GfxState *state, |
||||
GfxFunctionShading *shading) |
||||
{ return gFalse; } |
||||
virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading) |
||||
{ return gFalse; } |
||||
virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading) |
||||
{ return gFalse; } |
||||
|
||||
//----- path clipping
|
||||
virtual void clip(GfxState *state) {} |
||||
virtual void eoClip(GfxState *state) {} |
||||
virtual void clipToStrokePath(GfxState *state) {} |
||||
|
||||
//----- text drawing
|
||||
virtual void beginStringOp(GfxState *state) {} |
||||
virtual void endStringOp(GfxState *state) {} |
||||
virtual void beginString(GfxState *state, GString *s) {} |
||||
virtual void endString(GfxState *state) {} |
||||
virtual void drawChar(GfxState *state, double x, double y, |
||||
double dx, double dy, |
||||
double originX, double originY, |
||||
CharCode code, int nBytes, Unicode *u, int uLen) {} |
||||
virtual void drawString(GfxState *state, GString *s) {} |
||||
virtual GBool beginType3Char(GfxState *state, double x, double y, |
||||
double dx, double dy, |
||||
CharCode code, Unicode *u, int uLen); |
||||
virtual void endType3Char(GfxState *state) {} |
||||
virtual void endTextObject(GfxState *state) {} |
||||
virtual void incCharCount(int nChars) {} |
||||
|
||||
//----- image drawing
|
||||
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, GBool invert, |
||||
GBool inlineImg); |
||||
virtual void setSoftMaskFromImageMask(GfxState *state, |
||||
Object *ref, Stream *str, |
||||
int width, int height, GBool invert, |
||||
GBool inlineImg); |
||||
virtual void drawImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, GfxImageColorMap *colorMap, |
||||
int *maskColors, GBool inlineImg); |
||||
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, |
||||
GfxImageColorMap *colorMap, |
||||
Stream *maskStr, int maskWidth, int maskHeight, |
||||
GBool maskInvert); |
||||
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, |
||||
GfxImageColorMap *colorMap, |
||||
Stream *maskStr, |
||||
int maskWidth, int maskHeight, |
||||
GfxImageColorMap *maskColorMap); |
||||
|
||||
#if OPI_SUPPORT |
||||
//----- OPI functions
|
||||
virtual void opiBegin(GfxState *state, Dict *opiDict); |
||||
virtual void opiEnd(GfxState *state, Dict *opiDict); |
||||
#endif |
||||
|
||||
//----- Type 3 font operators
|
||||
virtual void type3D0(GfxState *state, double wx, double wy) {} |
||||
virtual void type3D1(GfxState *state, double wx, double wy, |
||||
double llx, double lly, double urx, double ury) {} |
||||
|
||||
//----- form XObjects
|
||||
virtual void drawForm(Ref id) {} |
||||
|
||||
//----- PostScript XObjects
|
||||
virtual void psXObject(Stream *psStream, Stream *level1Stream) {} |
||||
|
||||
//----- transparency groups and soft masks
|
||||
virtual void beginTransparencyGroup(GfxState *state, double *bbox, |
||||
GfxColorSpace *blendingColorSpace, |
||||
GBool isolated, GBool knockout, |
||||
GBool forSoftMask) {} |
||||
virtual void endTransparencyGroup(GfxState *state) {} |
||||
virtual void paintTransparencyGroup(GfxState *state, double *bbox) {} |
||||
virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, |
||||
Function *transferFunc, GfxColor *backdropColor) {} |
||||
virtual void clearSoftMask(GfxState *state) {} |
||||
|
||||
//----- links
|
||||
virtual void processLink(Link *link) {} |
||||
|
||||
#if 1 //~tmp: turn off anti-aliasing temporarily
|
||||
virtual void setInShading(GBool sh) {} |
||||
#endif |
||||
|
||||
private: |
||||
|
||||
double defCTM[6]; // default coordinate transform matrix
|
||||
double defICTM[6]; // inverse of default CTM
|
||||
}; |
||||
|
||||
#endif |
@ -1,207 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// PDFDoc.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef PDFDOC_H |
||||
#define PDFDOC_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include "XRef.h" |
||||
#include "Catalog.h" |
||||
#include "Page.h" |
||||
|
||||
class GString; |
||||
class BaseStream; |
||||
class OutputDev; |
||||
class Links; |
||||
class LinkAction; |
||||
class LinkDest; |
||||
class Outline; |
||||
class OptionalContent; |
||||
class PDFCore; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// PDFDoc
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class PDFDoc { |
||||
public: |
||||
|
||||
PDFDoc(GString *fileNameA, GString *ownerPassword = NULL, |
||||
GString *userPassword = NULL, PDFCore *coreA = NULL); |
||||
#ifdef WIN32 |
||||
PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword = NULL, |
||||
GString *userPassword = NULL, PDFCore *coreA = NULL); |
||||
#endif |
||||
PDFDoc(BaseStream *strA, GString *ownerPassword = NULL, |
||||
GString *userPassword = NULL, PDFCore *coreA = NULL); |
||||
~PDFDoc(); |
||||
|
||||
// Was PDF document successfully opened?
|
||||
GBool isOk() { return ok; } |
||||
|
||||
// Get the error code (if isOk() returns false).
|
||||
int getErrorCode() { return errCode; } |
||||
|
||||
// Get file name.
|
||||
GString *getFileName() { return fileName; } |
||||
#ifdef WIN32 |
||||
wchar_t *getFileNameU() { return fileNameU; } |
||||
#endif |
||||
|
||||
// Get the xref table.
|
||||
XRef *getXRef() { return xref; } |
||||
|
||||
// Get catalog.
|
||||
Catalog *getCatalog() { return catalog; } |
||||
|
||||
// Get base stream.
|
||||
BaseStream *getBaseStream() { return str; } |
||||
|
||||
// Get page parameters.
|
||||
double getPageMediaWidth(int page) |
||||
{ return catalog->getPage(page)->getMediaWidth(); } |
||||
double getPageMediaHeight(int page) |
||||
{ return catalog->getPage(page)->getMediaHeight(); } |
||||
double getPageCropWidth(int page) |
||||
{ return catalog->getPage(page)->getCropWidth(); } |
||||
double getPageCropHeight(int page) |
||||
{ return catalog->getPage(page)->getCropHeight(); } |
||||
int getPageRotate(int page) |
||||
{ return catalog->getPage(page)->getRotate(); } |
||||
|
||||
// Get number of pages.
|
||||
int getNumPages() { return catalog->getNumPages(); } |
||||
|
||||
// Return the contents of the metadata stream, or NULL if there is
|
||||
// no metadata.
|
||||
GString *readMetadata() { return catalog->readMetadata(); } |
||||
|
||||
// Return the structure tree root object.
|
||||
Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } |
||||
|
||||
// Display a page.
|
||||
void displayPage(OutputDev *out, int page, |
||||
double hDPI, double vDPI, int rotate, |
||||
GBool useMediaBox, GBool crop, GBool printing, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL); |
||||
|
||||
// Display a range of pages.
|
||||
void displayPages(OutputDev *out, int firstPage, int lastPage, |
||||
double hDPI, double vDPI, int rotate, |
||||
GBool useMediaBox, GBool crop, GBool printing, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL); |
||||
|
||||
// Display part of a page.
|
||||
void displayPageSlice(OutputDev *out, int page, |
||||
double hDPI, double vDPI, int rotate, |
||||
GBool useMediaBox, GBool crop, GBool printing, |
||||
int sliceX, int sliceY, int sliceW, int sliceH, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL); |
||||
|
||||
// Find a page, given its object ID. Returns page number, or 0 if
|
||||
// not found.
|
||||
int findPage(int num, int gen) { return catalog->findPage(num, gen); } |
||||
|
||||
// Returns the links for the current page, transferring ownership to
|
||||
// the caller.
|
||||
Links *getLinks(int page); |
||||
|
||||
// Find a named destination. Returns the link destination, or
|
||||
// NULL if <name> is not a destination.
|
||||
LinkDest *findDest(GString *name) |
||||
{ return catalog->findDest(name); } |
||||
|
||||
// Process the links for a page.
|
||||
void processLinks(OutputDev *out, int page); |
||||
|
||||
#ifndef DISABLE_OUTLINE |
||||
// Return the outline object.
|
||||
Outline *getOutline() { return outline; } |
||||
#endif |
||||
|
||||
// Return the OptionalContent object.
|
||||
OptionalContent *getOptionalContent() { return optContent; } |
||||
|
||||
// Is the file encrypted?
|
||||
GBool isEncrypted() { return xref->isEncrypted(); } |
||||
|
||||
// Check various permissions.
|
||||
GBool okToPrint(GBool ignoreOwnerPW = gFalse) |
||||
{ return xref->okToPrint(ignoreOwnerPW); } |
||||
GBool okToChange(GBool ignoreOwnerPW = gFalse) |
||||
{ return xref->okToChange(ignoreOwnerPW); } |
||||
GBool okToCopy(GBool ignoreOwnerPW = gFalse) |
||||
{ return xref->okToCopy(ignoreOwnerPW); } |
||||
GBool okToAddNotes(GBool ignoreOwnerPW = gFalse) |
||||
{ return xref->okToAddNotes(ignoreOwnerPW); } |
||||
|
||||
// Is this document linearized?
|
||||
GBool isLinearized(); |
||||
|
||||
// Return the document's Info dictionary (if any).
|
||||
Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); } |
||||
Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); } |
||||
|
||||
// Return the PDF version specified by the file.
|
||||
double getPDFVersion() { return pdfVersion; } |
||||
|
||||
// Save this file with another name.
|
||||
GBool saveAs(GString *name); |
||||
|
||||
// Return a pointer to the PDFCore object.
|
||||
PDFCore *getCore() { return core; } |
||||
|
||||
// Get the list of embedded files.
|
||||
int getNumEmbeddedFiles() { return catalog->getNumEmbeddedFiles(); } |
||||
Unicode *getEmbeddedFileName(int idx) |
||||
{ return catalog->getEmbeddedFileName(idx); } |
||||
int getEmbeddedFileNameLength(int idx) |
||||
{ return catalog->getEmbeddedFileNameLength(idx); } |
||||
GBool saveEmbeddedFile(int idx, char *path); |
||||
#ifdef WIN32 |
||||
GBool saveEmbeddedFile(int idx, wchar_t *path, int pathLen); |
||||
#endif |
||||
|
||||
|
||||
private: |
||||
|
||||
GBool setup(GString *ownerPassword, GString *userPassword); |
||||
void checkHeader(); |
||||
GBool checkEncryption(GString *ownerPassword, GString *userPassword); |
||||
GBool saveEmbeddedFile2(int idx, FILE *f); |
||||
|
||||
GString *fileName; |
||||
#ifdef WIN32 |
||||
wchar_t *fileNameU; |
||||
#endif |
||||
FILE *file; |
||||
BaseStream *str; |
||||
PDFCore *core; |
||||
double pdfVersion; |
||||
XRef *xref; |
||||
Catalog *catalog; |
||||
#ifndef DISABLE_OUTLINE |
||||
Outline *outline; |
||||
#endif |
||||
OptionalContent *optContent; |
||||
|
||||
|
||||
GBool ok; |
||||
int errCode; |
||||
}; |
||||
|
||||
#endif |
@ -1,199 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Page.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef PAGE_H |
||||
#define PAGE_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "Object.h" |
||||
|
||||
class Dict; |
||||
class PDFDoc; |
||||
class XRef; |
||||
class OutputDev; |
||||
class Links; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class PDFRectangle { |
||||
public: |
||||
double x1, y1, x2, y2; |
||||
|
||||
PDFRectangle() { x1 = y1 = x2 = y2 = 0; } |
||||
PDFRectangle(double x1A, double y1A, double x2A, double y2A) |
||||
{ x1 = x1A; y1 = y1A; x2 = x2A; y2 = y2A; } |
||||
GBool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; } |
||||
void clipTo(PDFRectangle *rect); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// PageAttrs
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class PageAttrs { |
||||
public: |
||||
|
||||
// Construct a new PageAttrs object by merging a dictionary
|
||||
// (of type Pages or Page) into another PageAttrs object. If
|
||||
// <attrs> is NULL, uses defaults.
|
||||
PageAttrs(PageAttrs *attrs, Dict *dict); |
||||
|
||||
// Construct a new PageAttrs object for an empty page (only used
|
||||
// when there is an error in the page tree).
|
||||
PageAttrs(); |
||||
|
||||
// Destructor.
|
||||
~PageAttrs(); |
||||
|
||||
// Accessors.
|
||||
PDFRectangle *getMediaBox() { return &mediaBox; } |
||||
PDFRectangle *getCropBox() { return &cropBox; } |
||||
GBool isCropped() { return haveCropBox; } |
||||
PDFRectangle *getBleedBox() { return &bleedBox; } |
||||
PDFRectangle *getTrimBox() { return &trimBox; } |
||||
PDFRectangle *getArtBox() { return &artBox; } |
||||
int getRotate() { return rotate; } |
||||
GString *getLastModified() |
||||
{ return lastModified.isString() |
||||
? lastModified.getString() : (GString *)NULL; } |
||||
Dict *getBoxColorInfo() |
||||
{ return boxColorInfo.isDict() ? boxColorInfo.getDict() : (Dict *)NULL; } |
||||
Dict *getGroup() |
||||
{ return group.isDict() ? group.getDict() : (Dict *)NULL; } |
||||
Stream *getMetadata() |
||||
{ return metadata.isStream() ? metadata.getStream() : (Stream *)NULL; } |
||||
Dict *getPieceInfo() |
||||
{ return pieceInfo.isDict() ? pieceInfo.getDict() : (Dict *)NULL; } |
||||
Dict *getSeparationInfo() |
||||
{ return separationInfo.isDict() |
||||
? separationInfo.getDict() : (Dict *)NULL; } |
||||
Dict *getResourceDict() |
||||
{ return resources.isDict() ? resources.getDict() : (Dict *)NULL; } |
||||
|
||||
// Clip all other boxes to the MediaBox.
|
||||
void clipBoxes(); |
||||
|
||||
private: |
||||
|
||||
GBool readBox(Dict *dict, char *key, PDFRectangle *box); |
||||
|
||||
PDFRectangle mediaBox; |
||||
PDFRectangle cropBox; |
||||
GBool haveCropBox; |
||||
PDFRectangle bleedBox; |
||||
PDFRectangle trimBox; |
||||
PDFRectangle artBox; |
||||
int rotate; |
||||
Object lastModified; |
||||
Object boxColorInfo; |
||||
Object group; |
||||
Object metadata; |
||||
Object pieceInfo; |
||||
Object separationInfo; |
||||
Object resources; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Page
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class Page { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
Page(PDFDoc *docA, int numA, Dict *pageDict, PageAttrs *attrsA); |
||||
|
||||
// Create an empty page (only used when there is an error in the
|
||||
// page tree).
|
||||
Page(PDFDoc *docA, int numA); |
||||
|
||||
// Destructor.
|
||||
~Page(); |
||||
|
||||
// Is page valid?
|
||||
GBool isOk() { return ok; } |
||||
|
||||
// Get page parameters.
|
||||
int getNum() { return num; } |
||||
PDFRectangle *getMediaBox() { return attrs->getMediaBox(); } |
||||
PDFRectangle *getCropBox() { return attrs->getCropBox(); } |
||||
GBool isCropped() { return attrs->isCropped(); } |
||||
double getMediaWidth()
|
||||
{ return attrs->getMediaBox()->x2 - attrs->getMediaBox()->x1; } |
||||
double getMediaHeight() |
||||
{ return attrs->getMediaBox()->y2 - attrs->getMediaBox()->y1; } |
||||
double getCropWidth()
|
||||
{ return attrs->getCropBox()->x2 - attrs->getCropBox()->x1; } |
||||
double getCropHeight() |
||||
{ return attrs->getCropBox()->y2 - attrs->getCropBox()->y1; } |
||||
PDFRectangle *getBleedBox() { return attrs->getBleedBox(); } |
||||
PDFRectangle *getTrimBox() { return attrs->getTrimBox(); } |
||||
PDFRectangle *getArtBox() { return attrs->getArtBox(); } |
||||
int getRotate() { return attrs->getRotate(); } |
||||
GString *getLastModified() { return attrs->getLastModified(); } |
||||
Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); } |
||||
Dict *getGroup() { return attrs->getGroup(); } |
||||
Stream *getMetadata() { return attrs->getMetadata(); } |
||||
Dict *getPieceInfo() { return attrs->getPieceInfo(); } |
||||
Dict *getSeparationInfo() { return attrs->getSeparationInfo(); } |
||||
|
||||
// Get resource dictionary.
|
||||
Dict *getResourceDict() { return attrs->getResourceDict(); } |
||||
|
||||
// Get annotations array.
|
||||
Object *getAnnots(Object *obj) { return annots.fetch(xref, obj); } |
||||
|
||||
// Return a list of links.
|
||||
Links *getLinks(); |
||||
|
||||
// Get contents.
|
||||
Object *getContents(Object *obj) { return contents.fetch(xref, obj); } |
||||
|
||||
// Display a page.
|
||||
void display(OutputDev *out, double hDPI, double vDPI, |
||||
int rotate, GBool useMediaBox, GBool crop, |
||||
GBool printing, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL); |
||||
|
||||
// Display part of a page.
|
||||
void displaySlice(OutputDev *out, double hDPI, double vDPI, |
||||
int rotate, GBool useMediaBox, GBool crop, |
||||
int sliceX, int sliceY, int sliceW, int sliceH, |
||||
GBool printing, |
||||
GBool (*abortCheckCbk)(void *data) = NULL, |
||||
void *abortCheckCbkData = NULL); |
||||
|
||||
void makeBox(double hDPI, double vDPI, int rotate, |
||||
GBool useMediaBox, GBool upsideDown, |
||||
double sliceX, double sliceY, double sliceW, double sliceH, |
||||
PDFRectangle *box, GBool *crop); |
||||
|
||||
void processLinks(OutputDev *out); |
||||
|
||||
// Get the page's default CTM.
|
||||
void getDefaultCTM(double *ctm, double hDPI, double vDPI, |
||||
int rotate, GBool useMediaBox, GBool upsideDown); |
||||
|
||||
private: |
||||
|
||||
PDFDoc *doc; |
||||
XRef *xref; // the xref table for this PDF file
|
||||
int num; // page number
|
||||
PageAttrs *attrs; // page attributes
|
||||
Object annots; // annotations array
|
||||
Object contents; // page contents
|
||||
GBool ok; // true if page is valid
|
||||
}; |
||||
|
||||
#endif |
@ -1,69 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// SplashBitmap.h
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef SPLASHBITMAP_H |
||||
#define SPLASHBITMAP_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include "SplashTypes.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SplashBitmap
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class SplashBitmap { |
||||
public: |
||||
|
||||
// Create a new bitmap. It will have <widthA> x <heightA> pixels in
|
||||
// color mode <modeA>. Rows will be padded out to a multiple of
|
||||
// <rowPad> bytes. If <topDown> is false, the bitmap will be stored
|
||||
// upside-down, i.e., with the last row first in memory.
|
||||
SplashBitmap(int widthA, int heightA, int rowPad, |
||||
SplashColorMode modeA, GBool alphaA, |
||||
GBool topDown = gTrue); |
||||
|
||||
~SplashBitmap(); |
||||
|
||||
int getWidth() { return width; } |
||||
int getHeight() { return height; } |
||||
int getRowSize() { return rowSize; } |
||||
int getAlphaRowSize() { return width; } |
||||
SplashColorMode getMode() { return mode; } |
||||
SplashColorPtr getDataPtr() { return data; } |
||||
Guchar *getAlphaPtr() { return alpha; } |
||||
|
||||
SplashError writePNMFile(char *fileName); |
||||
SplashError writePNMFile(FILE *f); |
||||
SplashError writeAlphaPGMFile(char *fileName); |
||||
|
||||
void getPixel(int x, int y, SplashColorPtr pixel); |
||||
Guchar getAlpha(int x, int y); |
||||
|
||||
// Caller takes ownership of the bitmap data. The SplashBitmap
|
||||
// object is no longer valid -- the next call should be to the
|
||||
// destructor.
|
||||
SplashColorPtr takeData(); |
||||
|
||||
private: |
||||
|
||||
int width, height; // size of bitmap
|
||||
int rowSize; // size of one row of data, in bytes
|
||||
// - negative for bottom-up bitmaps
|
||||
SplashColorMode mode; // color mode
|
||||
SplashColorPtr data; // pointer to row zero of the color data
|
||||
Guchar *alpha; // pointer to row zero of the alpha data
|
||||
// (always top-down)
|
||||
|
||||
friend class Splash; |
||||
}; |
||||
|
||||
#endif |
@ -1,277 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// SplashOutputDev.h
|
||||
//
|
||||
// Copyright 2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef SPLASHOUTPUTDEV_H |
||||
#define SPLASHOUTPUTDEV_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "SplashTypes.h" |
||||
#include "config.h" |
||||
#include "OutputDev.h" |
||||
#include "GfxState.h" |
||||
|
||||
class Gfx8BitFont; |
||||
class SplashBitmap; |
||||
class Splash; |
||||
class SplashPath; |
||||
class SplashPattern; |
||||
class SplashFontEngine; |
||||
class SplashFont; |
||||
class T3FontCache; |
||||
struct T3FontCacheTag; |
||||
struct T3GlyphStack; |
||||
struct SplashTransparencyGroup; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// number of Type 3 fonts to cache
|
||||
#define splashOutT3FontCacheSize 8 |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SplashOutputDev
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class SplashOutputDev: public OutputDev { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, |
||||
GBool reverseVideoA, SplashColorPtr paperColorA, |
||||
GBool bitmapTopDownA = gTrue, |
||||
GBool allowAntialiasA = gTrue); |
||||
|
||||
// Destructor.
|
||||
virtual ~SplashOutputDev(); |
||||
|
||||
//----- get info about output device
|
||||
|
||||
// Does this device use upside-down coordinates?
|
||||
// (Upside-down means (0,0) is the top left corner of the page.)
|
||||
virtual GBool upsideDown() { return bitmapTopDown ^ bitmapUpsideDown; } |
||||
|
||||
// Does this device use drawChar() or drawString()?
|
||||
virtual GBool useDrawChar() { return gTrue; } |
||||
|
||||
// Does this device use tilingPatternFill()? If this returns false,
|
||||
// tiling pattern fills will be reduced to a series of other drawing
|
||||
// operations.
|
||||
virtual GBool useTilingPatternFill() { return gTrue; } |
||||
|
||||
// Does this device use beginType3Char/endType3Char? Otherwise,
|
||||
// text in Type 3 fonts will be drawn with drawChar/drawString.
|
||||
virtual GBool interpretType3Chars() { return gTrue; } |
||||
|
||||
|
||||
//----- initialization and control
|
||||
|
||||
// Start a page.
|
||||
virtual void startPage(int pageNum, GfxState *state); |
||||
|
||||
// End a page.
|
||||
virtual void endPage(); |
||||
|
||||
//----- save/restore graphics state
|
||||
virtual void saveState(GfxState *state); |
||||
virtual void restoreState(GfxState *state); |
||||
|
||||
//----- update graphics state
|
||||
virtual void updateAll(GfxState *state); |
||||
virtual void updateCTM(GfxState *state, double m11, double m12, |
||||
double m21, double m22, double m31, double m32); |
||||
virtual void updateLineDash(GfxState *state); |
||||
virtual void updateFlatness(GfxState *state); |
||||
virtual void updateLineJoin(GfxState *state); |
||||
virtual void updateLineCap(GfxState *state); |
||||
virtual void updateMiterLimit(GfxState *state); |
||||
virtual void updateLineWidth(GfxState *state); |
||||
virtual void updateStrokeAdjust(GfxState *state); |
||||
virtual void updateFillColor(GfxState *state); |
||||
virtual void updateStrokeColor(GfxState *state); |
||||
virtual void updateBlendMode(GfxState *state); |
||||
virtual void updateFillOpacity(GfxState *state); |
||||
virtual void updateStrokeOpacity(GfxState *state); |
||||
|
||||
//----- update text state
|
||||
virtual void updateFont(GfxState *state); |
||||
|
||||
//----- path painting
|
||||
virtual void stroke(GfxState *state); |
||||
virtual void fill(GfxState *state); |
||||
virtual void eoFill(GfxState *state); |
||||
virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, |
||||
int paintType, Dict *resDict, |
||||
double *mat, double *bbox, |
||||
int x0, int y0, int x1, int y1, |
||||
double xStep, double yStep); |
||||
|
||||
//----- path clipping
|
||||
virtual void clip(GfxState *state); |
||||
virtual void eoClip(GfxState *state); |
||||
virtual void clipToStrokePath(GfxState *state); |
||||
|
||||
//----- text drawing
|
||||
virtual void drawChar(GfxState *state, double x, double y, |
||||
double dx, double dy, |
||||
double originX, double originY, |
||||
CharCode code, int nBytes, Unicode *u, int uLen); |
||||
virtual GBool beginType3Char(GfxState *state, double x, double y, |
||||
double dx, double dy, |
||||
CharCode code, Unicode *u, int uLen); |
||||
virtual void endType3Char(GfxState *state); |
||||
virtual void endTextObject(GfxState *state); |
||||
|
||||
//----- image drawing
|
||||
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, GBool invert, |
||||
GBool inlineImg); |
||||
virtual void setSoftMaskFromImageMask(GfxState *state, |
||||
Object *ref, Stream *str, |
||||
int width, int height, GBool invert, |
||||
GBool inlineImg); |
||||
virtual void drawImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, GfxImageColorMap *colorMap, |
||||
int *maskColors, GBool inlineImg); |
||||
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, |
||||
GfxImageColorMap *colorMap, |
||||
Stream *maskStr, int maskWidth, int maskHeight, |
||||
GBool maskInvert); |
||||
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, |
||||
int width, int height, |
||||
GfxImageColorMap *colorMap, |
||||
Stream *maskStr, |
||||
int maskWidth, int maskHeight, |
||||
GfxImageColorMap *maskColorMap); |
||||
|
||||
//----- Type 3 font operators
|
||||
virtual void type3D0(GfxState *state, double wx, double wy); |
||||
virtual void type3D1(GfxState *state, double wx, double wy, |
||||
double llx, double lly, double urx, double ury); |
||||
|
||||
//----- transparency groups and soft masks
|
||||
virtual void beginTransparencyGroup(GfxState *state, double *bbox, |
||||
GfxColorSpace *blendingColorSpace, |
||||
GBool isolated, GBool knockout, |
||||
GBool forSoftMask); |
||||
virtual void endTransparencyGroup(GfxState *state); |
||||
virtual void paintTransparencyGroup(GfxState *state, double *bbox); |
||||
virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, |
||||
Function *transferFunc, GfxColor *backdropColor); |
||||
virtual void clearSoftMask(GfxState *state); |
||||
|
||||
//----- special access
|
||||
|
||||
// Called to indicate that a new PDF document has been loaded.
|
||||
void startDoc(XRef *xrefA); |
||||
|
||||
void setPaperColor(SplashColorPtr paperColorA); |
||||
|
||||
GBool isReverseVideo() { return reverseVideo; } |
||||
void setReverseVideo(GBool reverseVideoA) { reverseVideo = reverseVideoA; } |
||||
|
||||
// Get the bitmap and its size.
|
||||
SplashBitmap *getBitmap() { return bitmap; } |
||||
int getBitmapWidth(); |
||||
int getBitmapHeight(); |
||||
|
||||
// Returns the last rasterized bitmap, transferring ownership to the
|
||||
// caller.
|
||||
SplashBitmap *takeBitmap(); |
||||
|
||||
// Set this flag to true to generate an upside-down bitmap (useful
|
||||
// for Windows BMP files).
|
||||
void setBitmapUpsideDown(GBool f) { bitmapUpsideDown = f; } |
||||
|
||||
// Get the Splash object.
|
||||
Splash *getSplash() { return splash; } |
||||
|
||||
// Get the modified region.
|
||||
void getModRegion(int *xMin, int *yMin, int *xMax, int *yMax); |
||||
|
||||
// Clear the modified region.
|
||||
void clearModRegion(); |
||||
|
||||
// Set the Splash fill color.
|
||||
void setFillColor(int r, int g, int b); |
||||
|
||||
// Get a font object for a Base-14 font, using the Latin-1 encoding.
|
||||
SplashFont *getFont(GString *name, SplashCoord *textMatA); |
||||
|
||||
SplashFont *getCurrentFont() { return font; } |
||||
|
||||
// If <skipTextA> is true, don't draw any text.
|
||||
void setSkipText(GBool skipTextA) { skipText = skipTextA; } |
||||
|
||||
int getNestCount() { return nestCount; } |
||||
|
||||
|
||||
#if 1 //~tmp: turn off anti-aliasing temporarily
|
||||
virtual void setInShading(GBool sh); |
||||
#endif |
||||
|
||||
private: |
||||
|
||||
void setupScreenParams(double hDPI, double vDPI); |
||||
SplashPattern *getColor(GfxGray gray); |
||||
SplashPattern *getColor(GfxRGB *rgb); |
||||
#if SPLASH_CMYK |
||||
SplashPattern *getColor(GfxCMYK *cmyk); |
||||
#endif |
||||
void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag, |
||||
int overprintMode, GfxColor *singleColor); |
||||
SplashPath *convertPath(GfxState *state, GfxPath *path); |
||||
void doUpdateFont(GfxState *state); |
||||
void drawType3Glyph(GfxState *state, T3FontCache *t3Font, |
||||
T3FontCacheTag *tag, Guchar *data); |
||||
static GBool imageMaskSrc(void *data, SplashColorPtr line); |
||||
static GBool imageSrc(void *data, SplashColorPtr colorLine, |
||||
Guchar *alphaLine); |
||||
static GBool alphaImageSrc(void *data, SplashColorPtr line, |
||||
Guchar *alphaLine); |
||||
static GBool maskedImageSrc(void *data, SplashColorPtr line, |
||||
Guchar *alphaLine); |
||||
|
||||
SplashColorMode colorMode; |
||||
int bitmapRowPad; |
||||
GBool bitmapTopDown; |
||||
GBool bitmapUpsideDown; |
||||
GBool allowAntialias; |
||||
GBool vectorAntialias; |
||||
GBool reverseVideo; // reverse video mode
|
||||
SplashColor paperColor; // paper color
|
||||
SplashScreenParams screenParams; |
||||
GBool skipText; |
||||
|
||||
XRef *xref; // xref table for current document
|
||||
|
||||
SplashBitmap *bitmap; |
||||
Splash *splash; |
||||
SplashFontEngine *fontEngine; |
||||
|
||||
T3FontCache * // Type 3 font cache
|
||||
t3FontCache[splashOutT3FontCacheSize]; |
||||
int nT3Fonts; // number of valid entries in t3FontCache
|
||||
T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack
|
||||
|
||||
SplashFont *font; // current font
|
||||
GBool needFontUpdate; // set when the font needs to be updated
|
||||
SplashPath *textClipPath; // clipping path built with text object
|
||||
|
||||
SplashTransparencyGroup * // transparency group stack
|
||||
transpGroupStack; |
||||
|
||||
int nestCount; |
||||
}; |
||||
|
||||
#endif |
@ -1,132 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// SplashTypes.h
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef SPLASHTYPES_H |
||||
#define SPLASHTYPES_H |
||||
|
||||
#include <aconf.h> |
||||
#include "gtypes.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// coordinates
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#if USE_FIXEDPOINT |
||||
#include "FixedPoint.h" |
||||
typedef FixedPoint SplashCoord; |
||||
#else |
||||
typedef double SplashCoord; |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// antialiasing
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#define splashAASize 4 |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// colors
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum SplashColorMode { |
||||
splashModeMono1, // 1 bit per component, 8 pixels per byte,
|
||||
// MSbit is on the left
|
||||
splashModeMono8, // 1 byte per component, 1 byte per pixel
|
||||
splashModeRGB8, // 1 byte per component, 3 bytes per pixel:
|
||||
// RGBRGB...
|
||||
splashModeBGR8 // 1 byte per component, 3 bytes per pixel:
|
||||
// BGRBGR...
|
||||
|
||||
#if SPLASH_CMYK |
||||
, |
||||
splashModeCMYK8 // 1 byte per component, 4 bytes per pixel:
|
||||
// CMYKCMYK...
|
||||
#endif |
||||
}; |
||||
|
||||
// number of components in each color mode
|
||||
// (defined in SplashState.cc)
|
||||
extern int splashColorModeNComps[]; |
||||
|
||||
// max number of components in any SplashColor
|
||||
#define splashMaxColorComps 3 |
||||
#if SPLASH_CMYK |
||||
# undef splashMaxColorComps |
||||
# define splashMaxColorComps 4 |
||||
#endif |
||||
|
||||
typedef Guchar SplashColor[splashMaxColorComps]; |
||||
typedef Guchar *SplashColorPtr; |
||||
|
||||
// RGB8
|
||||
static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; } |
||||
static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; } |
||||
static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; } |
||||
|
||||
// BGR8
|
||||
static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } |
||||
static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } |
||||
static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } |
||||
|
||||
#if SPLASH_CMYK |
||||
// CMYK8
|
||||
static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } |
||||
static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } |
||||
static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; } |
||||
static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; } |
||||
#endif |
||||
|
||||
static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { |
||||
dest[0] = src[0]; |
||||
dest[1] = src[1]; |
||||
dest[2] = src[2]; |
||||
#if SPLASH_CMYK |
||||
dest[3] = src[3]; |
||||
#endif |
||||
} |
||||
|
||||
static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { |
||||
dest[0] ^= src[0]; |
||||
dest[1] ^= src[1]; |
||||
dest[2] ^= src[2]; |
||||
#if SPLASH_CMYK |
||||
dest[3] ^= src[3]; |
||||
#endif |
||||
} |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// blend functions
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, |
||||
SplashColorPtr blend, SplashColorMode cm); |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// screen parameters
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum SplashScreenType { |
||||
splashScreenDispersed, |
||||
splashScreenClustered, |
||||
splashScreenStochasticClustered |
||||
}; |
||||
|
||||
struct SplashScreenParams { |
||||
SplashScreenType type; |
||||
int size; |
||||
int dotRadius; |
||||
SplashCoord gamma; |
||||
SplashCoord blackThreshold; |
||||
SplashCoord whiteThreshold; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// error results
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
typedef int SplashError; |
||||
|
||||
#endif |
@ -1,884 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// Stream.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef STREAM_H |
||||
#define STREAM_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include "gtypes.h" |
||||
#include "Object.h" |
||||
|
||||
class BaseStream; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum StreamKind { |
||||
strFile, |
||||
strASCIIHex, |
||||
strASCII85, |
||||
strLZW, |
||||
strRunLength, |
||||
strCCITTFax, |
||||
strDCT, |
||||
strFlate, |
||||
strJBIG2, |
||||
strJPX, |
||||
strWeird // internal-use stream types
|
||||
}; |
||||
|
||||
enum StreamColorSpaceMode { |
||||
streamCSNone, |
||||
streamCSDeviceGray, |
||||
streamCSDeviceRGB, |
||||
streamCSDeviceCMYK |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// This is in Stream.h instead of Decrypt.h to avoid really annoying
|
||||
// include file dependency loops.
|
||||
enum CryptAlgorithm { |
||||
cryptRC4, |
||||
cryptAES |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Stream (base class)
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class Stream { |
||||
public: |
||||
|
||||
// Constructor.
|
||||
Stream(); |
||||
|
||||
// Destructor.
|
||||
virtual ~Stream(); |
||||
|
||||
// Reference counting.
|
||||
int incRef() { return ++ref; } |
||||
int decRef() { return --ref; } |
||||
|
||||
// Get kind of stream.
|
||||
virtual StreamKind getKind() = 0; |
||||
|
||||
// Reset stream to beginning.
|
||||
virtual void reset() = 0; |
||||
|
||||
// Close down the stream.
|
||||
virtual void close(); |
||||
|
||||
// Get next char from stream.
|
||||
virtual int getChar() = 0; |
||||
|
||||
// Peek at next char in stream.
|
||||
virtual int lookChar() = 0; |
||||
|
||||
// Get next char from stream without using the predictor.
|
||||
// This is only used by StreamPredictor.
|
||||
virtual int getRawChar(); |
||||
|
||||
// Get next line from stream.
|
||||
virtual char *getLine(char *buf, int size); |
||||
|
||||
// Get current position in file.
|
||||
virtual int getPos() = 0; |
||||
|
||||
// Go to a position in the stream. If <dir> is negative, the
|
||||
// position is from the end of the file; otherwise the position is
|
||||
// from the start of the file.
|
||||
virtual void setPos(Guint pos, int dir = 0) = 0; |
||||
|
||||
// Get PostScript command for the filter(s).
|
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
|
||||
// Does this stream type potentially contain non-printable chars?
|
||||
virtual GBool isBinary(GBool last = gTrue) = 0; |
||||
|
||||
// Get the BaseStream of this stream.
|
||||
virtual BaseStream *getBaseStream() = 0; |
||||
|
||||
// Get the stream after the last decoder (this may be a BaseStream
|
||||
// or a DecryptStream).
|
||||
virtual Stream *getUndecodedStream() = 0; |
||||
|
||||
// Get the dictionary associated with this stream.
|
||||
virtual Dict *getDict() = 0; |
||||
|
||||
// Is this an encoding filter?
|
||||
virtual GBool isEncoder() { return gFalse; } |
||||
|
||||
// Get image parameters which are defined by the stream contents.
|
||||
virtual void getImageParams(int *bitsPerComponent, |
||||
StreamColorSpaceMode *csMode) {} |
||||
|
||||
// Return the next stream in the "stack".
|
||||
virtual Stream *getNextStream() { return NULL; } |
||||
|
||||
// Add filters to this stream according to the parameters in <dict>.
|
||||
// Returns the new stream.
|
||||
Stream *addFilters(Object *dict); |
||||
|
||||
private: |
||||
|
||||
Stream *makeFilter(char *name, Stream *str, Object *params); |
||||
|
||||
int ref; // reference count
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// BaseStream
|
||||
//
|
||||
// This is the base class for all streams that read directly from a file.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class BaseStream: public Stream { |
||||
public: |
||||
|
||||
BaseStream(Object *dictA); |
||||
virtual ~BaseStream(); |
||||
virtual Stream *makeSubStream(Guint start, GBool limited, |
||||
Guint length, Object *dict) = 0; |
||||
virtual void setPos(Guint pos, int dir = 0) = 0; |
||||
virtual GBool isBinary(GBool last = gTrue) { return last; } |
||||
virtual BaseStream *getBaseStream() { return this; } |
||||
virtual Stream *getUndecodedStream() { return this; } |
||||
virtual Dict *getDict() { return dict.getDict(); } |
||||
virtual GString *getFileName() { return NULL; } |
||||
|
||||
// Get/set position of first byte of stream within the file.
|
||||
virtual Guint getStart() = 0; |
||||
virtual void moveStart(int delta) = 0; |
||||
|
||||
private: |
||||
|
||||
Object dict; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FilterStream
|
||||
//
|
||||
// This is the base class for all streams that filter another stream.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FilterStream: public Stream { |
||||
public: |
||||
|
||||
FilterStream(Stream *strA); |
||||
virtual ~FilterStream(); |
||||
virtual void close(); |
||||
virtual int getPos() { return str->getPos(); } |
||||
virtual void setPos(Guint pos, int dir = 0); |
||||
virtual BaseStream *getBaseStream() { return str->getBaseStream(); } |
||||
virtual Stream *getUndecodedStream() { return str->getUndecodedStream(); } |
||||
virtual Dict *getDict() { return str->getDict(); } |
||||
virtual Stream *getNextStream() { return str; } |
||||
|
||||
protected: |
||||
|
||||
Stream *str; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ImageStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ImageStream { |
||||
public: |
||||
|
||||
// Create an image stream object for an image with the specified
|
||||
// parameters. Note that these are the actual image parameters,
|
||||
// which may be different from the predictor parameters.
|
||||
ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA); |
||||
|
||||
~ImageStream(); |
||||
|
||||
// Reset the stream.
|
||||
void reset(); |
||||
|
||||
// Gets the next pixel from the stream. <pix> should be able to hold
|
||||
// at least nComps elements. Returns false at end of file.
|
||||
GBool getPixel(Guchar *pix); |
||||
|
||||
// Returns a pointer to the next line of pixels. Returns NULL at
|
||||
// end of file.
|
||||
Guchar *getLine(); |
||||
|
||||
// Skip an entire line from the image.
|
||||
void skipLine(); |
||||
|
||||
private: |
||||
|
||||
Stream *str; // base stream
|
||||
int width; // pixels per line
|
||||
int nComps; // components per pixel
|
||||
int nBits; // bits per component
|
||||
int nVals; // components per line
|
||||
Guchar *imgLine; // line buffer
|
||||
int imgIdx; // current index in imgLine
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// StreamPredictor
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class StreamPredictor { |
||||
public: |
||||
|
||||
// Create a predictor object. Note that the parameters are for the
|
||||
// predictor, and may not match the actual image parameters.
|
||||
StreamPredictor(Stream *strA, int predictorA, |
||||
int widthA, int nCompsA, int nBitsA); |
||||
|
||||
~StreamPredictor(); |
||||
|
||||
GBool isOk() { return ok; } |
||||
|
||||
int lookChar(); |
||||
int getChar(); |
||||
|
||||
private: |
||||
|
||||
GBool getNextLine(); |
||||
|
||||
Stream *str; // base stream
|
||||
int predictor; // predictor
|
||||
int width; // pixels per line
|
||||
int nComps; // components per pixel
|
||||
int nBits; // bits per component
|
||||
int nVals; // components per line
|
||||
int pixBytes; // bytes per pixel
|
||||
int rowBytes; // bytes per line
|
||||
Guchar *predLine; // line buffer
|
||||
int predIdx; // current index in predLine
|
||||
GBool ok; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FileStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#define fileStreamBufSize 256 |
||||
|
||||
class FileStream: public BaseStream { |
||||
public: |
||||
|
||||
FileStream(FILE *fA, Guint startA, GBool limitedA, |
||||
Guint lengthA, Object *dictA); |
||||
virtual ~FileStream(); |
||||
virtual Stream *makeSubStream(Guint startA, GBool limitedA, |
||||
Guint lengthA, Object *dictA); |
||||
virtual StreamKind getKind() { return strFile; } |
||||
virtual void reset(); |
||||
virtual void close(); |
||||
virtual int getChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } |
||||
virtual int lookChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } |
||||
virtual int getPos() { return bufPos + (bufPtr - buf); } |
||||
virtual void setPos(Guint pos, int dir = 0); |
||||
virtual Guint getStart() { return start; } |
||||
virtual void moveStart(int delta); |
||||
|
||||
private: |
||||
|
||||
GBool fillBuf(); |
||||
|
||||
FILE *f; |
||||
Guint start; |
||||
GBool limited; |
||||
Guint length; |
||||
char buf[fileStreamBufSize]; |
||||
char *bufPtr; |
||||
char *bufEnd; |
||||
Guint bufPos; |
||||
int savePos; |
||||
GBool saved; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// MemStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class MemStream: public BaseStream { |
||||
public: |
||||
|
||||
MemStream(char *bufA, Guint startA, Guint lengthA, Object *dictA); |
||||
virtual ~MemStream(); |
||||
virtual Stream *makeSubStream(Guint start, GBool limited, |
||||
Guint lengthA, Object *dictA); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual void close(); |
||||
virtual int getChar() |
||||
{ return (bufPtr < bufEnd) ? (*bufPtr++ & 0xff) : EOF; } |
||||
virtual int lookChar() |
||||
{ return (bufPtr < bufEnd) ? (*bufPtr & 0xff) : EOF; } |
||||
virtual int getPos() { return (int)(bufPtr - buf); } |
||||
virtual void setPos(Guint pos, int dir = 0); |
||||
virtual Guint getStart() { return start; } |
||||
virtual void moveStart(int delta); |
||||
|
||||
private: |
||||
|
||||
char *buf; |
||||
Guint start; |
||||
Guint length; |
||||
char *bufEnd; |
||||
char *bufPtr; |
||||
GBool needFree; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// EmbedStream
|
||||
//
|
||||
// This is a special stream type used for embedded streams (inline
|
||||
// images). It reads directly from the base stream -- after the
|
||||
// EmbedStream is deleted, reads from the base stream will proceed where
|
||||
// the BaseStream left off. Note that this is very different behavior
|
||||
// that creating a new FileStream (using makeSubStream).
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class EmbedStream: public BaseStream { |
||||
public: |
||||
|
||||
EmbedStream(Stream *strA, Object *dictA, GBool limitedA, Guint lengthA); |
||||
virtual ~EmbedStream(); |
||||
virtual Stream *makeSubStream(Guint start, GBool limitedA, |
||||
Guint lengthA, Object *dictA); |
||||
virtual StreamKind getKind() { return str->getKind(); } |
||||
virtual void reset() {} |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual int getPos() { return str->getPos(); } |
||||
virtual void setPos(Guint pos, int dir = 0); |
||||
virtual Guint getStart(); |
||||
virtual void moveStart(int delta); |
||||
|
||||
private: |
||||
|
||||
Stream *str; |
||||
GBool limited; |
||||
Guint length; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ASCIIHexStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ASCIIHexStream: public FilterStream { |
||||
public: |
||||
|
||||
ASCIIHexStream(Stream *strA); |
||||
virtual ~ASCIIHexStream(); |
||||
virtual StreamKind getKind() { return strASCIIHex; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ int c = lookChar(); buf = EOF; return c; } |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
int buf; |
||||
GBool eof; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ASCII85Stream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ASCII85Stream: public FilterStream { |
||||
public: |
||||
|
||||
ASCII85Stream(Stream *strA); |
||||
virtual ~ASCII85Stream(); |
||||
virtual StreamKind getKind() { return strASCII85; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ int ch = lookChar(); ++index; return ch; } |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
int c[5]; |
||||
int b[4]; |
||||
int index, n; |
||||
GBool eof; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// LZWStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class LZWStream: public FilterStream { |
||||
public: |
||||
|
||||
LZWStream(Stream *strA, int predictor, int columns, int colors, |
||||
int bits, int earlyA); |
||||
virtual ~LZWStream(); |
||||
virtual StreamKind getKind() { return strLZW; } |
||||
virtual void reset(); |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual int getRawChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
StreamPredictor *pred; // predictor
|
||||
int early; // early parameter
|
||||
GBool eof; // true if at eof
|
||||
int inputBuf; // input buffer
|
||||
int inputBits; // number of bits in input buffer
|
||||
struct { // decoding table
|
||||
int length; |
||||
int head; |
||||
Guchar tail; |
||||
} table[4097]; |
||||
int nextCode; // next code to be used
|
||||
int nextBits; // number of bits in next code word
|
||||
int prevCode; // previous code used in stream
|
||||
int newChar; // next char to be added to table
|
||||
Guchar seqBuf[4097]; // buffer for current sequence
|
||||
int seqLength; // length of current sequence
|
||||
int seqIndex; // index into current sequence
|
||||
GBool first; // first code after a table clear
|
||||
|
||||
GBool processNextCode(); |
||||
void clearTable(); |
||||
int getCode(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// RunLengthStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class RunLengthStream: public FilterStream { |
||||
public: |
||||
|
||||
RunLengthStream(Stream *strA); |
||||
virtual ~RunLengthStream(); |
||||
virtual StreamKind getKind() { return strRunLength; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } |
||||
virtual int lookChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
char buf[128]; // buffer
|
||||
char *bufPtr; // next char to read
|
||||
char *bufEnd; // end of buffer
|
||||
GBool eof; |
||||
|
||||
GBool fillBuf(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// CCITTFaxStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
struct CCITTCodeTable; |
||||
|
||||
class CCITTFaxStream: public FilterStream { |
||||
public: |
||||
|
||||
CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, |
||||
GBool byteAlignA, int columnsA, int rowsA, |
||||
GBool endOfBlockA, GBool blackA); |
||||
virtual ~CCITTFaxStream(); |
||||
virtual StreamKind getKind() { return strCCITTFax; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ int c = lookChar(); buf = EOF; return c; } |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
int encoding; // 'K' parameter
|
||||
GBool endOfLine; // 'EndOfLine' parameter
|
||||
GBool byteAlign; // 'EncodedByteAlign' parameter
|
||||
int columns; // 'Columns' parameter
|
||||
int rows; // 'Rows' parameter
|
||||
GBool endOfBlock; // 'EndOfBlock' parameter
|
||||
GBool black; // 'BlackIs1' parameter
|
||||
GBool eof; // true if at eof
|
||||
GBool nextLine2D; // true if next line uses 2D encoding
|
||||
int row; // current row
|
||||
Guint inputBuf; // input buffer
|
||||
int inputBits; // number of bits in input buffer
|
||||
int *codingLine; // coding line changing elements
|
||||
int *refLine; // reference line changing elements
|
||||
int a0i; // index into codingLine
|
||||
GBool err; // error on current line
|
||||
int outputBits; // remaining ouput bits
|
||||
int buf; // character buffer
|
||||
|
||||
void addPixels(int a1, int blackPixels); |
||||
void addPixelsNeg(int a1, int blackPixels); |
||||
short getTwoDimCode(); |
||||
short getWhiteCode(); |
||||
short getBlackCode(); |
||||
short lookBits(int n); |
||||
void eatBits(int n) { if ((inputBits -= n) < 0) inputBits = 0; } |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// DCTStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// DCT component info
|
||||
struct DCTCompInfo { |
||||
int id; // component ID
|
||||
int hSample, vSample; // horiz/vert sampling resolutions
|
||||
int quantTable; // quantization table number
|
||||
int prevDC; // DC coefficient accumulator
|
||||
}; |
||||
|
||||
struct DCTScanInfo { |
||||
GBool comp[4]; // comp[i] is set if component i is
|
||||
// included in this scan
|
||||
int numComps; // number of components in the scan
|
||||
int dcHuffTable[4]; // DC Huffman table numbers
|
||||
int acHuffTable[4]; // AC Huffman table numbers
|
||||
int firstCoeff, lastCoeff; // first and last DCT coefficient
|
||||
int ah, al; // successive approximation parameters
|
||||
}; |
||||
|
||||
// DCT Huffman decoding table
|
||||
struct DCTHuffTable { |
||||
Guchar firstSym[17]; // first symbol for this bit length
|
||||
Gushort firstCode[17]; // first code for this bit length
|
||||
Gushort numCodes[17]; // number of codes of this bit length
|
||||
Guchar sym[256]; // symbols
|
||||
}; |
||||
|
||||
class DCTStream: public FilterStream { |
||||
public: |
||||
|
||||
DCTStream(Stream *strA, int colorXformA); |
||||
virtual ~DCTStream(); |
||||
virtual StreamKind getKind() { return strDCT; } |
||||
virtual void reset(); |
||||
virtual void close(); |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
Stream *getRawStream() { return str; } |
||||
|
||||
private: |
||||
|
||||
GBool progressive; // set if in progressive mode
|
||||
GBool interleaved; // set if in interleaved mode
|
||||
int width, height; // image size
|
||||
int mcuWidth, mcuHeight; // size of min coding unit, in data units
|
||||
int bufWidth, bufHeight; // frameBuf size
|
||||
DCTCompInfo compInfo[4]; // info for each component
|
||||
DCTScanInfo scanInfo; // info for the current scan
|
||||
int numComps; // number of components in image
|
||||
int colorXform; // color transform: -1 = unspecified
|
||||
// 0 = none
|
||||
// 1 = YUV/YUVK -> RGB/CMYK
|
||||
GBool gotJFIFMarker; // set if APP0 JFIF marker was present
|
||||
GBool gotAdobeMarker; // set if APP14 Adobe marker was present
|
||||
int restartInterval; // restart interval, in MCUs
|
||||
Gushort quantTables[4][64]; // quantization tables
|
||||
int numQuantTables; // number of quantization tables
|
||||
DCTHuffTable dcHuffTables[4]; // DC Huffman tables
|
||||
DCTHuffTable acHuffTables[4]; // AC Huffman tables
|
||||
int numDCHuffTables; // number of DC Huffman tables
|
||||
int numACHuffTables; // number of AC Huffman tables
|
||||
Guchar *rowBuf[4][32]; // buffer for one MCU (non-progressive mode)
|
||||
int *frameBuf[4]; // buffer for frame (progressive mode)
|
||||
int comp, x, y, dy; // current position within image/MCU
|
||||
int restartCtr; // MCUs left until restart
|
||||
int restartMarker; // next restart marker
|
||||
int eobRun; // number of EOBs left in the current run
|
||||
int inputBuf; // input buffer for variable length codes
|
||||
int inputBits; // number of valid bits in input buffer
|
||||
|
||||
void restart(); |
||||
GBool readMCURow(); |
||||
void readScan(); |
||||
GBool readDataUnit(DCTHuffTable *dcHuffTable, |
||||
DCTHuffTable *acHuffTable, |
||||
int *prevDC, int data[64]); |
||||
GBool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, |
||||
DCTHuffTable *acHuffTable, |
||||
int *prevDC, int data[64]); |
||||
void decodeImage(); |
||||
void transformDataUnit(Gushort *quantTable, |
||||
int dataIn[64], Guchar dataOut[64]); |
||||
int readHuffSym(DCTHuffTable *table); |
||||
int readAmp(int size); |
||||
int readBit(); |
||||
GBool readHeader(); |
||||
GBool readBaselineSOF(); |
||||
GBool readProgressiveSOF(); |
||||
GBool readScanInfo(); |
||||
GBool readQuantTables(); |
||||
GBool readHuffmanTables(); |
||||
GBool readRestartInterval(); |
||||
GBool readJFIFMarker(); |
||||
GBool readAdobeMarker(); |
||||
GBool readTrailer(); |
||||
int readMarker(); |
||||
int read16(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FlateStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#define flateWindow 32768 // buffer size
|
||||
#define flateMask (flateWindow-1) |
||||
#define flateMaxHuffman 15 // max Huffman code length
|
||||
#define flateMaxCodeLenCodes 19 // max # code length codes
|
||||
#define flateMaxLitCodes 288 // max # literal codes
|
||||
#define flateMaxDistCodes 30 // max # distance codes
|
||||
|
||||
// Huffman code table entry
|
||||
struct FlateCode { |
||||
Gushort len; // code length, in bits
|
||||
Gushort val; // value represented by this code
|
||||
}; |
||||
|
||||
struct FlateHuffmanTab { |
||||
FlateCode *codes; |
||||
int maxLen; |
||||
}; |
||||
|
||||
// Decoding info for length and distance code words
|
||||
struct FlateDecode { |
||||
int bits; // # extra bits
|
||||
int first; // first length/distance
|
||||
}; |
||||
|
||||
class FlateStream: public FilterStream { |
||||
public: |
||||
|
||||
FlateStream(Stream *strA, int predictor, int columns, |
||||
int colors, int bits); |
||||
virtual ~FlateStream(); |
||||
virtual StreamKind getKind() { return strFlate; } |
||||
virtual void reset(); |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual int getRawChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent); |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
private: |
||||
|
||||
StreamPredictor *pred; // predictor
|
||||
Guchar buf[flateWindow]; // output data buffer
|
||||
int index; // current index into output buffer
|
||||
int remain; // number valid bytes in output buffer
|
||||
int codeBuf; // input buffer
|
||||
int codeSize; // number of bits in input buffer
|
||||
int // literal and distance code lengths
|
||||
codeLengths[flateMaxLitCodes + flateMaxDistCodes]; |
||||
FlateHuffmanTab litCodeTab; // literal code table
|
||||
FlateHuffmanTab distCodeTab; // distance code table
|
||||
GBool compressedBlock; // set if reading a compressed block
|
||||
int blockLen; // remaining length of uncompressed block
|
||||
GBool endOfBlock; // set when end of block is reached
|
||||
GBool eof; // set when end of stream is reached
|
||||
|
||||
static int // code length code reordering
|
||||
codeLenCodeMap[flateMaxCodeLenCodes]; |
||||
static FlateDecode // length decoding info
|
||||
lengthDecode[flateMaxLitCodes-257]; |
||||
static FlateDecode // distance decoding info
|
||||
distDecode[flateMaxDistCodes]; |
||||
static FlateHuffmanTab // fixed literal code table
|
||||
fixedLitCodeTab; |
||||
static FlateHuffmanTab // fixed distance code table
|
||||
fixedDistCodeTab; |
||||
|
||||
void readSome(); |
||||
GBool startBlock(); |
||||
void loadFixedCodes(); |
||||
GBool readDynamicCodes(); |
||||
void compHuffmanCodes(int *lengths, int n, FlateHuffmanTab *tab); |
||||
int getHuffmanCodeWord(FlateHuffmanTab *tab); |
||||
int getCodeWord(int bits); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// EOFStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class EOFStream: public FilterStream { |
||||
public: |
||||
|
||||
EOFStream(Stream *strA); |
||||
virtual ~EOFStream(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset() {} |
||||
virtual int getChar() { return EOF; } |
||||
virtual int lookChar() { return EOF; } |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue) { return gFalse; } |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// BufStream
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class BufStream: public FilterStream { |
||||
public: |
||||
|
||||
BufStream(Stream *strA, int bufSizeA); |
||||
virtual ~BufStream(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
|
||||
int lookChar(int idx); |
||||
|
||||
private: |
||||
|
||||
int *buf; |
||||
int bufSize; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FixedLengthEncoder
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FixedLengthEncoder: public FilterStream { |
||||
public: |
||||
|
||||
FixedLengthEncoder(Stream *strA, int lengthA); |
||||
~FixedLengthEncoder(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual int getChar(); |
||||
virtual int lookChar(); |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue); |
||||
virtual GBool isEncoder() { return gTrue; } |
||||
|
||||
private: |
||||
|
||||
int length; |
||||
int count; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ASCIIHexEncoder
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ASCIIHexEncoder: public FilterStream { |
||||
public: |
||||
|
||||
ASCIIHexEncoder(Stream *strA); |
||||
virtual ~ASCIIHexEncoder(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } |
||||
virtual int lookChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue) { return gFalse; } |
||||
virtual GBool isEncoder() { return gTrue; } |
||||
|
||||
private: |
||||
|
||||
char buf[4]; |
||||
char *bufPtr; |
||||
char *bufEnd; |
||||
int lineLen; |
||||
GBool eof; |
||||
|
||||
GBool fillBuf(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ASCII85Encoder
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class ASCII85Encoder: public FilterStream { |
||||
public: |
||||
|
||||
ASCII85Encoder(Stream *strA); |
||||
virtual ~ASCII85Encoder(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } |
||||
virtual int lookChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue) { return gFalse; } |
||||
virtual GBool isEncoder() { return gTrue; } |
||||
|
||||
private: |
||||
|
||||
char buf[8]; |
||||
char *bufPtr; |
||||
char *bufEnd; |
||||
int lineLen; |
||||
GBool eof; |
||||
|
||||
GBool fillBuf(); |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// RunLengthEncoder
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class RunLengthEncoder: public FilterStream { |
||||
public: |
||||
|
||||
RunLengthEncoder(Stream *strA); |
||||
virtual ~RunLengthEncoder(); |
||||
virtual StreamKind getKind() { return strWeird; } |
||||
virtual void reset(); |
||||
virtual int getChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } |
||||
virtual int lookChar() |
||||
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } |
||||
virtual GString *getPSFilter(int psLevel, char *indent) { return NULL; } |
||||
virtual GBool isBinary(GBool last = gTrue) { return gTrue; } |
||||
virtual GBool isEncoder() { return gTrue; } |
||||
|
||||
private: |
||||
|
||||
char buf[131]; |
||||
char *bufPtr; |
||||
char *bufEnd; |
||||
char *nextEnd; |
||||
GBool eof; |
||||
|
||||
GBool fillBuf(); |
||||
}; |
||||
|
||||
#endif |
@ -1,134 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// XRef.h
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef XREF_H |
||||
#define XREF_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "Object.h" |
||||
|
||||
class Dict; |
||||
class Stream; |
||||
class Parser; |
||||
class ObjectStream; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// XRef
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum XRefEntryType { |
||||
xrefEntryFree, |
||||
xrefEntryUncompressed, |
||||
xrefEntryCompressed |
||||
}; |
||||
|
||||
struct XRefEntry { |
||||
Guint offset; |
||||
int gen; |
||||
XRefEntryType type; |
||||
}; |
||||
|
||||
class XRef { |
||||
public: |
||||
|
||||
// Constructor. Read xref table from stream.
|
||||
XRef(BaseStream *strA); |
||||
|
||||
// Destructor.
|
||||
~XRef(); |
||||
|
||||
// Is xref table valid?
|
||||
GBool isOk() { return ok; } |
||||
|
||||
// Get the error code (if isOk() returns false).
|
||||
int getErrorCode() { return errCode; } |
||||
|
||||
// Set the encryption parameters.
|
||||
void setEncryption(int permFlagsA, GBool ownerPasswordOkA, |
||||
Guchar *fileKeyA, int keyLengthA, int encVersionA, |
||||
CryptAlgorithm encAlgorithmA); |
||||
|
||||
// Is the file encrypted?
|
||||
GBool isEncrypted() { return encrypted; } |
||||
|
||||
// Check various permissions.
|
||||
GBool okToPrint(GBool ignoreOwnerPW = gFalse); |
||||
GBool okToChange(GBool ignoreOwnerPW = gFalse); |
||||
GBool okToCopy(GBool ignoreOwnerPW = gFalse); |
||||
GBool okToAddNotes(GBool ignoreOwnerPW = gFalse); |
||||
|
||||
// Get catalog object.
|
||||
Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); } |
||||
|
||||
// Fetch an indirect reference.
|
||||
Object *fetch(int num, int gen, Object *obj, int recursion = 0); |
||||
|
||||
// Return the document's Info dictionary (if any).
|
||||
Object *getDocInfo(Object *obj); |
||||
Object *getDocInfoNF(Object *obj); |
||||
|
||||
// Return the number of objects in the xref table.
|
||||
int getNumObjects() { return last + 1; } |
||||
|
||||
// Return the offset of the last xref table.
|
||||
Guint getLastXRefPos() { return lastXRefPos; } |
||||
|
||||
// Return the catalog object reference.
|
||||
int getRootNum() { return rootNum; } |
||||
int getRootGen() { return rootGen; } |
||||
|
||||
// Get end position for a stream in a damaged file.
|
||||
// Returns false if unknown or file is not damaged.
|
||||
GBool getStreamEnd(Guint streamStart, Guint *streamEnd); |
||||
|
||||
// Direct access.
|
||||
int getSize() { return size; } |
||||
XRefEntry *getEntry(int i) { return &entries[i]; } |
||||
Object *getTrailerDict() { return &trailerDict; } |
||||
|
||||
private: |
||||
|
||||
BaseStream *str; // input stream
|
||||
Guint start; // offset in file (to allow for garbage
|
||||
// at beginning of file)
|
||||
XRefEntry *entries; // xref entries
|
||||
int size; // size of <entries> array
|
||||
int last; // last used index in <entries>
|
||||
int rootNum, rootGen; // catalog dict
|
||||
GBool ok; // true if xref table is valid
|
||||
int errCode; // error code (if <ok> is false)
|
||||
Object trailerDict; // trailer dictionary
|
||||
Guint lastXRefPos; // offset of last xref table
|
||||
Guint *streamEnds; // 'endstream' positions - only used in
|
||||
// damaged files
|
||||
int streamEndsLen; // number of valid entries in streamEnds
|
||||
ObjectStream *objStr; // cached object stream
|
||||
GBool encrypted; // true if file is encrypted
|
||||
int permFlags; // permission bits
|
||||
GBool ownerPasswordOk; // true if owner password is correct
|
||||
Guchar fileKey[16]; // file decryption key
|
||||
int keyLength; // length of key, in bytes
|
||||
int encVersion; // encryption version
|
||||
CryptAlgorithm encAlgorithm; // encryption algorithm
|
||||
|
||||
Guint getStartXref(); |
||||
GBool readXRef(Guint *pos); |
||||
GBool readXRefTable(Parser *parser, Guint *pos); |
||||
GBool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n); |
||||
GBool readXRefStream(Stream *xrefStr, Guint *pos); |
||||
GBool constructXRef(); |
||||
Guint strToUnsigned(char *s); |
||||
}; |
||||
|
||||
#endif |
@ -1,106 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// config.h
|
||||
//
|
||||
// Copyright 1996-2009 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef CONFIG_H |
||||
#define CONFIG_H |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// version
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// xpdf version
|
||||
#define xpdfVersion "3.02.27" |
||||
#define xpdfVersionNum 3.02 |
||||
#define xpdfMajorVersion 3 |
||||
#define xpdfMinorVersion 2 |
||||
#define xpdfUpdateVersion 27 |
||||
#define xpdfMajorVersionStr "3" |
||||
#define xpdfMinorVersionStr "2" |
||||
#define xpdfUpdateVersionStr "27" |
||||
|
||||
// supported PDF version
|
||||
#define supportedPDFVersionStr "1.7" |
||||
#define supportedPDFVersionNum 1.7 |
||||
|
||||
// copyright notice
|
||||
#define xpdfCopyright "Copyright 1996-2009 Glyph & Cog, LLC" |
||||
|
||||
// Windows resource file stuff
|
||||
#define winxpdfVersion "WinXpdf 3.02.27" |
||||
#define xpdfCopyrightAmp "Copyright 1996-2009 Glyph && Cog, LLC" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// paper size
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// default paper size (in points) for PostScript output
|
||||
#ifdef A4_PAPER |
||||
#define defPaperWidth 595 // ISO A4 (210x297 mm)
|
||||
#define defPaperHeight 842 |
||||
#else |
||||
#define defPaperWidth 612 // American letter (8.5x11")
|
||||
#define defPaperHeight 792 |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// config file (xpdfrc) path
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// user config file name, relative to the user's home directory
|
||||
#if defined(VMS) || defined(WIN32) |
||||
#define xpdfUserConfigFile "xpdfrc" |
||||
#else |
||||
#define xpdfUserConfigFile ".xpdfrc" |
||||
#endif |
||||
|
||||
// system config file name (set via the configure script)
|
||||
#ifdef SYSTEM_XPDFRC |
||||
#define xpdfSysConfigFile SYSTEM_XPDFRC |
||||
#else |
||||
// under Windows, we get the directory with the executable and then
|
||||
// append this file name
|
||||
#define xpdfSysConfigFile "xpdfrc" |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// X-related constants
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// default maximum size of color cube to allocate
|
||||
#define defaultRGBCube 5 |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// popen
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) |
||||
#define popen _popen |
||||
#define pclose _pclose |
||||
#endif |
||||
|
||||
#if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(WIN32) || defined(__DJGPP__) || defined(MACOS) |
||||
#define POPEN_READ_MODE "rb" |
||||
#else |
||||
#define POPEN_READ_MODE "r" |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Win32 stuff
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#ifdef CDECL |
||||
#undef CDECL |
||||
#endif |
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) |
||||
#define CDECL __cdecl |
||||
#else |
||||
#define CDECL |
||||
#endif |
||||
|
||||
#endif |
@ -1,79 +0,0 @@ |
||||
/*
|
||||
* gmem.h |
||||
* |
||||
* Memory routines with out-of-memory checking. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef GMEM_H |
||||
#define GMEM_H |
||||
|
||||
#include <stdio.h> |
||||
#include <aconf.h> |
||||
|
||||
#if USE_EXCEPTIONS |
||||
|
||||
class GMemException { |
||||
public: |
||||
GMemException() {} |
||||
~GMemException() {} |
||||
}; |
||||
|
||||
#define GMEM_EXCEP throw(GMemException) |
||||
|
||||
#else // USE_EXCEPTIONS
|
||||
|
||||
#define GMEM_EXCEP |
||||
|
||||
#endif // USE_EXCEPTIONS
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/*
|
||||
* Same as malloc, but prints error message and exits if malloc() |
||||
* returns NULL. |
||||
*/ |
||||
extern void *gmalloc(int size) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* Same as realloc, but prints error message and exits if realloc() |
||||
* returns NULL. If <p> is NULL, calls malloc instead of realloc(). |
||||
*/ |
||||
extern void *grealloc(void *p, int size) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* These are similar to gmalloc and grealloc, but take an object count |
||||
* and size. The result is similar to allocating nObjs * objSize |
||||
* bytes, but there is an additional error check that the total size |
||||
* doesn't overflow an int. |
||||
*/ |
||||
extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP; |
||||
extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* Same as free, but checks for and ignores NULL pointers. |
||||
*/ |
||||
extern void gfree(void *p); |
||||
|
||||
#ifdef DEBUG_MEM |
||||
/*
|
||||
* Report on unfreed memory. |
||||
*/ |
||||
extern void gMemReport(FILE *f); |
||||
#else |
||||
#define gMemReport(f) |
||||
#endif |
||||
|
||||
/*
|
||||
* Allocate memory and copy a string into it. |
||||
*/ |
||||
extern char *copyString(char *s); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -1,29 +0,0 @@ |
||||
/*
|
||||
* gtypes.h |
||||
* |
||||
* Some useful simple types. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef GTYPES_H |
||||
#define GTYPES_H |
||||
|
||||
/*
|
||||
* These have stupid names to avoid conflicts with some (but not all) |
||||
* C++ compilers which define them. |
||||
*/ |
||||
typedef int GBool; |
||||
#define gTrue 1 |
||||
#define gFalse 0 |
||||
|
||||
/*
|
||||
* These have stupid names to avoid conflicts with <sys/types.h>, |
||||
* which on various systems defines some random subset of these. |
||||
*/ |
||||
typedef unsigned char Guchar; |
||||
typedef unsigned short Gushort; |
||||
typedef unsigned int Guint; |
||||
typedef unsigned long Gulong; |
||||
|
||||
#endif |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,34 +0,0 @@ |
||||
Subject: ANNOUNCE: Xpdf 3.02 - a PDF viewer for X |
||||
|
||||
|
||||
Glyph & Cog, LLC is pleased to announce a new version of Xpdf, the |
||||
open source Portable Document Format (PDF) viewer for X. The Xpdf |
||||
project also includes a PDF text extractor, PDF-to-PostScript |
||||
converter, and various other utilities. |
||||
|
||||
Xpdf runs under the X Window System on Unix, VMS, and OS/2. The non-X |
||||
components (pdftops, pdftotext, etc.) also run on Win32 systems and |
||||
should run on pretty much any system with a decent C++ compiler. |
||||
|
||||
Major changes: |
||||
* Anti-aliased vector graphics, including stroke adjustment. |
||||
* Support for PDF 1.6 and PDF 1.7, including AES decryption and |
||||
OpenType fonts. |
||||
* User-configurable key/mouse bindings. |
||||
* Improved full-screen mode, with the ability to toggle on the fly. |
||||
|
||||
See the `CHANGES' file for a complete list of changes. |
||||
|
||||
Source (C++ and C) is available, and it should be fairly easy to |
||||
compile for UNIX, VMS, OS/2, and Win32. |
||||
|
||||
More information, source code, and precompiled binaries are on the |
||||
xpdf web page and ftp site: |
||||
|
||||
http://www.foolabs.com/xpdf/ |
||||
ftp://ftp.foolabs.com/pub/xpdf/ |
||||
|
||||
For information on commercial licensing and consulting, please see the |
||||
Glyph & Cog web site: |
||||
|
||||
http://www.glyphandcog.com/ |
File diff suppressed because it is too large
Load Diff
@ -1,248 +0,0 @@ |
||||
Xpdf |
||||
==== |
||||
|
||||
version 3.02 |
||||
2007-feb-27 |
||||
|
||||
The Xpdf software and documentation are |
||||
copyright 1996-2007 Glyph & Cog, LLC. |
||||
|
||||
Email: derekn@foolabs.com |
||||
WWW: http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
Compiling xpdf |
||||
-------------- |
||||
|
||||
Xpdf is written in C++ (with a little bit of C). It should work with |
||||
any ANSI-compliant C++ and C compilers. The systems and compilers |
||||
it's been tested with are listed on the xpdf web page. |
||||
|
||||
Xpdf requires the Motif (or Lesstif) toolkit. |
||||
|
||||
The following notes give specific instructions for compiling on |
||||
different systems. |
||||
|
||||
|
||||
************** |
||||
*** UNIX *** |
||||
************** |
||||
|
||||
* Install t1lib (if desired). The resulting library (libt1) and |
||||
include files (t1lib.h and t1libx.h) should be placed somewhere on |
||||
the standard search paths. Alternatively, when you configure xpdf, |
||||
you can use the following options to tell configure where to find |
||||
the t1lib files: |
||||
|
||||
--with-t1-library=PATH |
||||
--with-t1-includes=PATH |
||||
|
||||
* Install FreeType 2 (this is required). WARNING: You must have |
||||
version 2.0.5 or newer. Some older versions of XFree86 ship with an |
||||
older version of FreeType, which means you'll need to explicitly set |
||||
include and library paths to get the correct version: |
||||
|
||||
--with-freetype2-library=PATH |
||||
--with-freetype2-includes=PATH |
||||
|
||||
(The include path is the directory which contains the freetype2 |
||||
directory, i.e., do NOT include "freetype2" in the |
||||
--with-freetype2-includes path. For example, with the default |
||||
installation, the library path is /usr/local/lib and the include |
||||
path is /usr/local/include/freetype2.) |
||||
|
||||
* If you have Motif (or Lesstif) installed in a non-standard place, |
||||
you can use the following options to tell configure where to find |
||||
it: |
||||
|
||||
--with-Xm-library=PATH |
||||
--with-Xm-includes=PATH |
||||
|
||||
* Run the configure script: |
||||
|
||||
./configure |
||||
|
||||
This should produce a set of makefiles customized for your system. |
||||
The configure script accepts the following options (in addition to |
||||
the usual things accepted by autoconf configure scripts): |
||||
|
||||
--prefix=PREFIX |
||||
Changes the directory where xpdf is installed. The default is |
||||
/usr/local. |
||||
|
||||
--enable-a4-paper |
||||
Switches the default paper size for PostScript output (xpdf |
||||
and pdftops) to A4. The default is Letter size. |
||||
|
||||
--enable-no-text-select |
||||
With this option, xpdf will not copy text. (This is only |
||||
useful on closed systems where the user can't get at the PDF |
||||
file directly.) |
||||
|
||||
--enable-opi |
||||
Enables support for generation of OPI (Open Prepress |
||||
Interface) comments with pdftops. |
||||
|
||||
--sysconfdir=DIR |
||||
Look for the system-wide xpdfrc config file in this directory. |
||||
The default is PREFIX/etc. |
||||
|
||||
--with-appdef-dir=DIR |
||||
Use the specified app-defaults directory. The default is |
||||
/usr/lib/X11/app-defaults. |
||||
|
||||
If you need to pass specific options to the C and/or C++ compiler, |
||||
you can set the CFLAGS and/or CXXFLAGS environment variables before |
||||
running the configure script. Any options given that way will be |
||||
added to the CFLAGS/CXXFLAGS used by all of the Xpdf makefiles. |
||||
|
||||
* Type 'make'. This should build the executables: |
||||
|
||||
xpdf/xpdf |
||||
xpdf/pdftops |
||||
xpdf/pdftotext |
||||
xpdf/pdfinfo |
||||
xpdf/pdffonts |
||||
xpdf/pdftoppm |
||||
xpdf/pdfimages |
||||
|
||||
* If desired, type 'make install' to install the binaries and man |
||||
pages. |
||||
|
||||
The old Makefile.config and Makefiles are no longer provided or |
||||
supported. If you really want to manually configure Xpdf (which is |
||||
not recommended), the files that need to be created are aconf.h, |
||||
Makefile, goo/Makefile, fofi/Makefile, splash/Makefile, and |
||||
xpdf/Makefile, all of which are generated from the corresponding '.in' |
||||
files. |
||||
|
||||
If you want to run a quick test, there is a tiny PDF file included |
||||
with xpdf, as misc/hello.pdf . |
||||
|
||||
|
||||
************* |
||||
*** VMS *** |
||||
************* |
||||
|
||||
* The 'stddef.h' include file which comes with older versions of gcc |
||||
may be missing a definition for wchar_t. In this case, add the |
||||
following lines: |
||||
----- |
||||
File GNU_CC:[INCLUDE]STDDEF.H;2 |
||||
44 /* Wide characters, not yet supported by VAXCRTL [match VAXC's <stddef. |
||||
45 #if !defined(_WCHAR_T) && !defined(_WCHAR_T_) |
||||
46 typedef unsigned int wchar_t; |
||||
47 #endif |
||||
48 #define _WCHAR_T |
||||
49 #define _WCHAR_T_ |
||||
50 |
||||
----- |
||||
|
||||
* Read the instructions at the top of vms_make.com. |
||||
|
||||
* Type '@vms_make' in the top-level directory. You'll probably want |
||||
to use some of the options described in the file. |
||||
|
||||
* The executables will be left in '[.xpdf]'. |
||||
|
||||
If you want to run a quick test, there is a tiny PDF file included |
||||
with xpdf, as misc/hello.pdf . |
||||
|
||||
|
||||
************** |
||||
*** OS/2 *** |
||||
************** |
||||
|
||||
Xpdf is known to run under OS/2 with the EMX runtime environment and |
||||
XFree86. Using a proper autoconf port you can generate a valid |
||||
configure script version. |
||||
|
||||
|
||||
*************** |
||||
*** Win32 *** |
||||
*************** |
||||
|
||||
The non-X programs (pdftops, pdftotext, pdfinfo, pdffonts, pdfimages, |
||||
and pdftoppm) will compile with both gcc (from cygwin), djgpp (the |
||||
Delorie port of gcc) and Microsoft Visual C++. |
||||
|
||||
With cygwin, the build procedure is the same as for Unix: |
||||
|
||||
* Open a shell. |
||||
|
||||
* ./configure |
||||
|
||||
* make |
||||
|
||||
* make install |
||||
|
||||
It is also possible to build the Xpdf viewer with the cygwin XFree86 |
||||
port (thanks to Michael A. Richmond for these instructions): |
||||
|
||||
* make sure you have the lesstif, XFree86-base, and XFree86-prog |
||||
cygwin packages installed (all from the "XFree86" category) |
||||
|
||||
* to build t1lib: |
||||
- cd T1Lib-x.y |
||||
- ./configure --without-x |
||||
- make without_doc |
||||
- make install |
||||
(this should install /usr/local/include/t1lib.h and |
||||
/usr/local/lib/libt1.a) |
||||
|
||||
* to build xpdf: |
||||
- cd xpdf-x.yy |
||||
- ./configure --with-t1-library=/usr/local/lib |
||||
--with-t1-includes=/usr/local/include |
||||
--with-freetype2-library=/usr/X11R6/lib |
||||
--with-freetype2-includes=/usr/X11R6/include/freetype2 |
||||
--with-Xm-library=/usr/X11R6/lib |
||||
--with-Xm-includes=/usr/X11R6/include |
||||
(all on one line) |
||||
- make |
||||
(this should build xpdf.exe, in addition to the command line |
||||
utilities) |
||||
|
||||
With djgpp: |
||||
|
||||
* Open a DOS window. |
||||
|
||||
* ./dj_make |
||||
|
||||
* djgpp is a DOS/Windows port of gcc, available from |
||||
http://www.delorie.com/ |
||||
|
||||
With djgpp, for DOS 6 (instead of Win32): |
||||
|
||||
* ./dj_make |
||||
|
||||
* cd xpdf |
||||
|
||||
* strip pdftops.exe |
||||
|
||||
* exe2coff pdftops.exe |
||||
|
||||
* copy /B c:\djgpp\bin\cwsdstub.exe+pdftops pdftops.exe |
||||
|
||||
* upx pdftops.exe |
||||
- if you want compressed executables |
||||
|
||||
* and similarly for the other executables |
||||
|
||||
* cwsdstub.exe comes from djgpp/v2misc/csdpmi5b.zip on any of the |
||||
djgpp ftp mirrors; exe2coff is part of the standard djgpp install |
||||
|
||||
* upx comes from http://upx.sourceforge.net/ |
||||
|
||||
With the Microsoft tools: |
||||
|
||||
* Open a DOS window. |
||||
|
||||
* Type "cl". If you get the message "Bad command or file name", you |
||||
must run VCVARS32.BAT. (The location of this BAT file can be |
||||
determined with Explorer.) |
||||
|
||||
* Type "ms_make" |
||||
|
||||
The dj_make and ms_make scripts don't build pdftoppm -- you'll need to |
||||
install t1lib and FreeType 2 before you can compile pdftoppm. |
@ -1,126 +0,0 @@ |
||||
#========================================================================
|
||||
#
|
||||
# Main xpdf Makefile.
|
||||
#
|
||||
# Copyright 1996-2003 Glyph & Cog, LLC
|
||||
#
|
||||
#========================================================================
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
DESTDIR =
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
EXE = @EXE@
|
||||
|
||||
all: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) @XPDF_TARGET@
|
||||
|
||||
all-no-x: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) all-no-x
|
||||
|
||||
xpdf: dummy |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) xpdf$(EXE)
|
||||
|
||||
pdftops: dummy |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdftops$(EXE)
|
||||
|
||||
pdftotext: dummy |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdftotext$(EXE)
|
||||
|
||||
pdfinfo: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdfinfo$(EXE)
|
||||
|
||||
pdffonts: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdffonts$(EXE)
|
||||
|
||||
pdftoppm: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdftoppm$(EXE)
|
||||
|
||||
pdfimages: |
||||
cd goo; $(MAKE)
|
||||
cd @UP_DIR@fofi; $(MAKE)
|
||||
cd @UP_DIR@splash; $(MAKE)
|
||||
cd @UP_DIR@xpdf; $(MAKE) pdfimages$(EXE)
|
||||
|
||||
dummy: |
||||
|
||||
install: dummy |
||||
-mkdir -p $(DESTDIR)@bindir@
|
||||
@X@ $(INSTALL_PROGRAM) xpdf/xpdf$(EXE) $(DESTDIR)@bindir@/xpdf$(EXE) |
||||
$(INSTALL_PROGRAM) xpdf/pdftops$(EXE) $(DESTDIR)@bindir@/pdftops$(EXE)
|
||||
$(INSTALL_PROGRAM) xpdf/pdftotext$(EXE) $(DESTDIR)@bindir@/pdftotext$(EXE)
|
||||
$(INSTALL_PROGRAM) xpdf/pdfinfo$(EXE) $(DESTDIR)@bindir@/pdfinfo$(EXE)
|
||||
$(INSTALL_PROGRAM) xpdf/pdffonts$(EXE) $(DESTDIR)@bindir@/pdffonts$(EXE)
|
||||
@X@ $(INSTALL_PROGRAM) xpdf/pdftoppm$(EXE) $(DESTDIR)@bindir@/pdftoppm$(EXE) |
||||
$(INSTALL_PROGRAM) xpdf/pdfimages$(EXE) $(DESTDIR)@bindir@/pdfimages$(EXE)
|
||||
-mkdir -p $(DESTDIR)@mandir@/man1
|
||||
@X@ $(INSTALL_DATA) $(srcdir)/doc/xpdf.1 $(DESTDIR)@mandir@/man1/xpdf.1 |
||||
$(INSTALL_DATA) $(srcdir)/doc/pdftops.1 $(DESTDIR)@mandir@/man1/pdftops.1
|
||||
$(INSTALL_DATA) $(srcdir)/doc/pdftotext.1 $(DESTDIR)@mandir@/man1/pdftotext.1
|
||||
$(INSTALL_DATA) $(srcdir)/doc/pdfinfo.1 $(DESTDIR)@mandir@/man1/pdfinfo.1
|
||||
$(INSTALL_DATA) $(srcdir)/doc/pdffonts.1 $(DESTDIR)@mandir@/man1/pdffonts.1
|
||||
@X@ $(INSTALL_DATA) $(srcdir)/doc/pdftoppm.1 $(DESTDIR)@mandir@/man1/pdftoppm.1 |
||||
$(INSTALL_DATA) $(srcdir)/doc/pdfimages.1 $(DESTDIR)@mandir@/man1/pdfimages.1
|
||||
-mkdir -p $(DESTDIR)@mandir@/man5
|
||||
$(INSTALL_DATA) $(srcdir)/doc/xpdfrc.5 $(DESTDIR)@mandir@/man5/xpdfrc.5
|
||||
-mkdir -p $(DESTDIR)@sysconfdir@
|
||||
@if test ! -f $(DESTDIR)@sysconfdir@/xpdfrc; then \
|
||||
echo "$(INSTALL_DATA) $(srcdir)/doc/sample-xpdfrc $(DESTDIR)@sysconfdir@/xpdfrc"; \
|
||||
$(INSTALL_DATA) $(srcdir)/doc/sample-xpdfrc $(DESTDIR)@sysconfdir@/xpdfrc; \
|
||||
else \
|
||||
echo "# not overwriting the existing $(DESTDIR)@sysconfdir@/xpdfrc"; \
|
||||
fi
|
||||
|
||||
clean: |
||||
-cd goo; $(MAKE) clean
|
||||
-cd @UP_DIR@fofi; $(MAKE) clean
|
||||
-cd @UP_DIR@splash; $(MAKE) clean
|
||||
-cd @UP_DIR@xpdf; $(MAKE) clean
|
||||
|
||||
distclean: clean |
||||
rm -f config.log config.status config.cache
|
||||
rm -f aconf.h
|
||||
rm -f Makefile goo/Makefile xpdf/Makefile
|
||||
rm -f goo/Makefile.dep fofi/Makefile.dep splash/Makefile.dep xpdf/Makefile.dep
|
||||
rm -f goo/Makefile.in.bak fofi/Makefile.in.bak splash/Makefile.in.bak xpdf/Makefile.in.bak
|
||||
touch goo/Makefile.dep
|
||||
touch fofi/Makefile.dep
|
||||
touch splash/Makefile.dep
|
||||
touch xpdf/Makefile.dep
|
||||
|
||||
depend: |
||||
cd goo; $(MAKE) depend
|
||||
cd @UP_DIR@fofi; $(MAKE) depend
|
||||
cd @UP_DIR@splash; $(MAKE) depend
|
||||
cd @UP_DIR@xpdf; $(MAKE) depend
|
@ -1,19 +0,0 @@ |
||||
Xpdf |
||||
==== |
||||
|
||||
version 3.02 |
||||
2007-feb-27 |
||||
|
||||
The Xpdf software and documentation are |
||||
copyright 1996-2007 Glyph & Cog, LLC. |
||||
|
||||
Email: info@glyphandcog.com |
||||
WWW: http://www.glyphandcog.com/ |
||||
|
||||
The PDF data structures, operators, and specification are |
||||
copyright 1985-2006 Adobe Systems Inc. |
||||
|
||||
***** |
||||
|
||||
This tar file contains the source code for Xpdf, packaged for holders |
||||
of commercial source code licenses. |
@ -1,274 +0,0 @@ |
||||
# <<< smr.m4 from smr_macros 0.2.4 >>> |
||||
|
||||
dnl ####################### -*- Mode: M4 -*- ########################### |
||||
dnl smr.m4 -- |
||||
dnl |
||||
dnl Copyright (C) 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU> |
||||
dnl Copyright (C) 1998 Steve Robbins <stever@cs.mcgill.ca> |
||||
dnl |
||||
dnl This file is free software; you can redistribute it and/or modify it |
||||
dnl under the terms of the GNU General Public License as published by |
||||
dnl the Free Software Foundation; either version 2 of the License, or |
||||
dnl (at your option) any later version. |
||||
dnl |
||||
dnl This file is distributed in the hope that it will be useful, but |
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
dnl General Public License for more details. |
||||
dnl |
||||
dnl You should have received a copy of the GNU General Public License |
||||
dnl along with this file; if not, write to: |
||||
dnl |
||||
dnl Free Software Foundation, Inc. |
||||
dnl Suite 330 |
||||
dnl 59 Temple Place |
||||
dnl Boston, MA 02111-1307, USA. |
||||
dnl #################################################################### |
||||
|
||||
|
||||
dnl NOTE: The macros in this file are extensively documented in the |
||||
dnl accompanying `smr_macros.texi' Texinfo file. Please see the |
||||
dnl Texinfo documentation for the definitive specification of how |
||||
dnl these macros are supposed to work. If the macros work |
||||
dnl differently than the Texinfo documentation says they should, |
||||
dnl then the macros (and not the Texinfo documentation) has the |
||||
dnl bug(s). |
||||
|
||||
dnl This is a convenient macro which translates illegal characters for |
||||
dnl bourne shell variables into legal characters. It has the same |
||||
dnl functionality as sed 'y%./+-:%__p__%'. |
||||
AC_DEFUN([smr_safe_translation], [patsubst(patsubst([$1], [+], [p]), [./-:], [_])]) |
||||
|
||||
AC_DEFUN(smr_SWITCH, |
||||
[ |
||||
dnl Define convenient aliases for the arguments since there are so |
||||
dnl many of them and I keep confusing myself whenever I have to edit |
||||
dnl this macro. |
||||
pushdef([smr_name], $1) |
||||
pushdef([smr_help_string], $2) |
||||
pushdef([smr_default], $3) |
||||
pushdef([smr_yes_define], $4) |
||||
pushdef([smr_no_define], $5) |
||||
|
||||
dnl Do some sanity checking of the arguments. |
||||
ifelse([regexp(smr_default, [^\(yes\|no\)$])], -1, [AC_MSG_ERROR($0: third arg must be either yes or no)]) |
||||
|
||||
dnl Create the help string |
||||
pushdef([smr_lhs], [--ifelse(smr_default, yes, disable, enable)-smr_name])dnl |
||||
pushdef([smr_rhs], [ifelse(smr_default, yes, disable, enable) smr_help_string (default is smr_default)])dnl |
||||
|
||||
dnl Add the option to `configure --help'. We don't need to supply the |
||||
dnl 4th argument to AC_ARG_ENABLE (i.e. the code to set the default |
||||
dnl value) because that is done below by AC_CACHE_CHECK. |
||||
AC_ARG_ENABLE([smr_name], |
||||
AC_HELP_STRING([smr_lhs], [smr_rhs]), |
||||
smr_cv_enable_[]smr_name=$enableval) |
||||
|
||||
dnl We cache the result so that the user doesn't have to remember |
||||
dnl which flags they passed to `configure'. |
||||
AC_CACHE_CHECK([whether to enable smr_help_string], |
||||
smr_cv_enable_[]smr_name, |
||||
smr_cv_enable_[]smr_name=smr_default) |
||||
|
||||
ifelse(smr_yes_define, , , test x"[$]smr_cv_enable_[]smr_name" = xyes && AC_DEFINE(smr_yes_define)) |
||||
ifelse(smr_no_define, , , test x"[$]smr_cv_enable_[]smr_name" = xno && AC_DEFINE(smr_no_define)) |
||||
|
||||
dnl Sanity check the value assigned to smr_cv_enable_$1 to force it to |
||||
dnl be either `yes' or `no'. |
||||
if test ! x"[$]smr_cv_enable_[]smr_name" = xyes; then |
||||
if test ! x"[$]smr_cv_enable_[]smr_name" = xno; then |
||||
AC_MSG_ERROR([smr_lhs must be either yes or no]) |
||||
fi |
||||
fi |
||||
|
||||
popdef([smr_name]) |
||||
popdef([smr_help_string]) |
||||
popdef([smr_default]) |
||||
popdef([smr_yes_define]) |
||||
popdef([smr_no_define]) |
||||
popdef([smr_lhs]) |
||||
popdef([smr_rhs]) |
||||
]) |
||||
|
||||
|
||||
AC_DEFUN(smr_ARG_WITHLIB, |
||||
[ |
||||
dnl Define convenient aliases for the arguments since there are so |
||||
dnl many of them and I keep confusing myself whenever I have to edit |
||||
dnl this macro. |
||||
pushdef([smr_name], $1) |
||||
pushdef([smr_libname], ifelse($2, , smr_name, $2)) |
||||
pushdef([smr_help_string], $3) |
||||
pushdef([smr_safe_name], smr_safe_translation(smr_name)) |
||||
|
||||
dnl Add the option to `configure --help'. We don't need to supply the |
||||
dnl 4th argument to AC_ARG_WITH (i.e. the code to set the default |
||||
dnl value) because that is done below by AC_CACHE_CHECK. |
||||
AC_ARG_WITH(smr_safe_name-library, |
||||
AC_HELP_STRING([--with-smr_safe_name-library[[=PATH]]], |
||||
[use smr_name library ifelse(smr_help_string, , , (smr_help_string))]), |
||||
smr_cv_with_[]smr_safe_name[]_library=$withval) |
||||
|
||||
dnl We cache the result so that the user doesn't have to remember |
||||
dnl which flags they passed to `configure'. |
||||
AC_CACHE_CHECK([whether to use smr_name library], |
||||
smr_cv_with_[]smr_safe_name[]_library, |
||||
smr_cv_with_[]smr_safe_name[]_library=maybe) |
||||
|
||||
|
||||
case x"[$]smr_cv_with_[]smr_safe_name[]_library" in |
||||
xyes | xmaybe) |
||||
smr_safe_name[]_LIBS="-l[]smr_libname" |
||||
with_[]smr_safe_name=[$]smr_cv_with_[]smr_safe_name[]_library |
||||
;; |
||||
xno) |
||||
smr_safe_name[]_LIBS= |
||||
with_[]smr_safe_name=no |
||||
;; |
||||
*) |
||||
if test -f "[$]smr_cv_with_[]smr_safe_name[]_library"; then |
||||
smr_safe_name[]_LIBS=[$]smr_cv_with_[]smr_safe_name[]_library |
||||
elif test -d "[$]smr_cv_with_[]smr_safe_name[]_library"; then |
||||
smr_safe_name[]_LIBS="-L[$]smr_cv_with_[]smr_safe_name[]_library -l[]smr_libname" |
||||
else |
||||
AC_MSG_ERROR([argument must be boolean, file, or directory]) |
||||
fi |
||||
with_[]smr_safe_name=yes |
||||
;; |
||||
esac |
||||
|
||||
popdef([smr_name]) |
||||
popdef([smr_libname]) |
||||
popdef([smr_help_string]) |
||||
popdef([smr_safe_name]) |
||||
]) |
||||
|
||||
|
||||
AC_DEFUN(smr_ARG_WITHINCLUDES, |
||||
[ |
||||
dnl Define convenient aliases for the arguments since there are so |
||||
dnl many of them and I keep confusing myself whenever I have to edit |
||||
dnl this macro. |
||||
pushdef([smr_name], $1) |
||||
pushdef([smr_header], $2) |
||||
pushdef([smr_extra_flags], $3) |
||||
pushdef([smr_safe_name], smr_safe_translation(smr_name)) |
||||
|
||||
dnl Add the option to `configure --help'. We don't need to supply the |
||||
dnl 4th argument to AC_ARG_WITH (i.e. the code to set the default |
||||
dnl value) because that is done below by AC_CACHE_CHECK. |
||||
AC_ARG_WITH(smr_safe_name-includes, |
||||
AC_HELP_STRING([--with-smr_safe_name-includes[[=DIR]]], |
||||
[set directory for smr_name headers]), |
||||
smr_cv_with_[]smr_safe_name[]_includes=$withval) |
||||
|
||||
dnl We cache the result so that the user doesn't have to remember |
||||
dnl which flags they passed to `configure'. |
||||
AC_CACHE_CHECK([where to find the smr_name header files], |
||||
smr_cv_with_[]smr_safe_name[]_includes, |
||||
smr_cv_with_[]smr_safe_name[]_includes=) |
||||
|
||||
if test ! x"[$]smr_cv_with_[]smr_safe_name[]_includes" = x; then |
||||
if test -d "[$]smr_cv_with_[]smr_safe_name[]_includes"; then |
||||
smr_safe_name[]_CFLAGS="-I[$]smr_cv_with_[]smr_safe_name[]_includes" |
||||
else |
||||
AC_MSG_ERROR([argument must be a directory]) |
||||
fi |
||||
else |
||||
smr_safe_name[]_CFLAGS= |
||||
fi |
||||
|
||||
dnl This bit of logic comes from the autoconf AC_PROG_CC macro. We |
||||
dnl need to put the given include directory into CPPFLAGS temporarily, |
||||
dnl but then restore CPPFLAGS to its old value. |
||||
smr_test_CPPFLAGS="${CPPFLAGS+set}" |
||||
smr_save_CPPFLAGS="$CPPFLAGS" |
||||
CPPFLAGS="$CPPFLAGS [$]smr_safe_name[]_CFLAGS smr_extra_flags" |
||||
|
||||
dnl If the header file smr_header exists, then define |
||||
dnl HAVE_[]smr_header (in all capitals). |
||||
AC_CHECK_HEADERS([smr_header], |
||||
smr_have_[]smr_safe_name[]_header=yes, |
||||
smr_have_[]smr_safe_name[]_header=no) |
||||
|
||||
if test x"$smr_test_CPPFLAGS" = xset; then |
||||
CPPFLAGS=$smr_save_CPPFLAGS |
||||
else |
||||
unset CPPFLAGS |
||||
fi |
||||
|
||||
popdef([smr_name]) |
||||
popdef([smr_header]) |
||||
popdef([smr_extra_flags]) |
||||
popdef([smr_safe_name]) |
||||
]) |
||||
|
||||
|
||||
AC_DEFUN(smr_CHECK_LIB, |
||||
[ |
||||
dnl Define convenient aliases for the arguments since there are so |
||||
dnl many of them and I keep confusing myself whenever I have to edit |
||||
dnl this macro. |
||||
pushdef([smr_name], $1) |
||||
pushdef([smr_libname], ifelse($2, , smr_name, $2)) |
||||
pushdef([smr_help_string], $3) |
||||
pushdef([smr_function], $4) |
||||
pushdef([smr_header], $5) |
||||
pushdef([smr_extra_libs], $6) |
||||
pushdef([smr_extra_flags], $7) |
||||
pushdef([smr_prototype], $8) |
||||
pushdef([smr_safe_name], smr_safe_translation(smr_name)) |
||||
|
||||
dnl Give the user (via "configure --help") an interface to specify |
||||
dnl whether we should use the library or not, and possibly where we |
||||
dnl should find it. |
||||
smr_ARG_WITHLIB([smr_name], [smr_libname], [smr_help_string]) |
||||
|
||||
if test ! x"$with_[]smr_safe_name" = xno; then |
||||
|
||||
# If we got this far, then the user didn't explicitly ask not to use |
||||
# the library. |
||||
|
||||
dnl If the caller of smr_CHECK_LIB specified a header file for this |
||||
dnl library, then give the user (via "configure --help") an |
||||
dnl interface to specify where this header file can be found (if it |
||||
dnl isn't found by the compiler by default). |
||||
ifelse(smr_header, , , [smr_ARG_WITHINCLUDES(smr_name, smr_header, smr_extra_flags)]) |
||||
|
||||
# We need only look for the library if the header has been found |
||||
# (or no header is needed). |
||||
if test [$]smr_have_[]smr_safe_name[]_header != no; then |
||||
|
||||
AC_CHECK_LIB(smr_libname, |
||||
smr_function, |
||||
smr_have_[]smr_safe_name[]_library=yes, |
||||
smr_have_[]smr_safe_name[]_library=no, |
||||
[$]smr_safe_name[]_CFLAGS [smr_extra_flags] [$]smr_safe_name[]_LIBS [smr_extra_libs], |
||||
[ifelse(smr_prototype, , , [[#]include <smr_header>])], |
||||
smr_prototype) |
||||
fi |
||||
|
||||
if test x"[$]smr_have_[]smr_safe_name[]_library" = xyes; then |
||||
AC_MSG_RESULT([using smr_name library]) |
||||
else |
||||
smr_safe_name[]_LIBS= |
||||
smr_safe_name[]_CFLAGS= |
||||
|
||||
if test x"$with_[]smr_safe_name" = xmaybe; then |
||||
AC_MSG_RESULT([not using smr_name library]) |
||||
else |
||||
AC_MSG_WARN([requested smr_name library not found!]) |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
popdef([smr_name]) |
||||
popdef([smr_libname]) |
||||
popdef([smr_help_string]) |
||||
popdef([smr_function]) |
||||
popdef([smr_header]) |
||||
popdef([smr_extra_libs]) |
||||
popdef([smr_extra_flags]) |
||||
popdef([smr_prototype]) |
||||
popdef([smr_safe_name]) |
||||
]) |
@ -1,78 +0,0 @@ |
||||
/*
|
||||
* aconf-dj.h |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF_H |
||||
#define ACONF_H |
||||
|
||||
/*
|
||||
* Use A4 paper size instead of Letter for PostScript output. |
||||
*/ |
||||
#undef A4_PAPER |
||||
|
||||
/*
|
||||
* Do not allow text selection. |
||||
*/ |
||||
#undef NO_TEXT_SELECT |
||||
|
||||
/*
|
||||
* Include support for OPI comments. |
||||
*/ |
||||
#undef OPI_SUPPORT |
||||
|
||||
/*
|
||||
* Directory with the Xpdf app-defaults file. |
||||
*/ |
||||
#undef APPDEFDIR |
||||
|
||||
/*
|
||||
* Full path for the system-wide xpdfrc file. |
||||
*/ |
||||
#undef SYSTEM_XPDFRC |
||||
|
||||
/*
|
||||
* Various include files and functions. |
||||
*/ |
||||
#define HAVE_DIRENT_H 1 |
||||
#undef HAVE_SYS_NDIR_H |
||||
#undef HAVE_SYS_DIR_H |
||||
#undef HAVE_NDIR_H |
||||
#undef HAVE_SYS_SELECT_H |
||||
#undef HAVE_SYS_BSDTYPES_H |
||||
#undef HAVE_STRINGS_H |
||||
#undef HAVE_BSTRING_H |
||||
#define HAVE_POPEN 1 |
||||
#undef HAVE_MKSTEMP |
||||
#undef SELECT_TAKES_INT |
||||
#define HAVE_STD_SORT 1 |
||||
#undef HAVE_FSEEK64 |
||||
|
||||
/*
|
||||
* This is defined if using libXpm. |
||||
*/ |
||||
#undef HAVE_X11_XPM_H |
||||
|
||||
/*
|
||||
* This is defined if using t1lib. |
||||
*/ |
||||
#undef HAVE_T1LIB_H |
||||
|
||||
/*
|
||||
* One of these is defined if using FreeType (version 1 or 2). |
||||
*/ |
||||
#undef HAVE_FREETYPE_H |
||||
#undef HAVE_FREETYPE_FREETYPE_H |
||||
|
||||
/*
|
||||
* This is defined if using FreeType version 2. |
||||
*/ |
||||
#undef FREETYPE2 |
||||
|
||||
/*
|
||||
* This is defined if using libpaper. |
||||
*/ |
||||
#undef HAVE_PAPER_H |
||||
|
||||
#endif |
@ -1,121 +0,0 @@ |
||||
/*
|
||||
* aconf-win32.h |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF_H |
||||
#define ACONF_H |
||||
|
||||
#include <aconf2.h> |
||||
|
||||
/*
|
||||
* Use A4 paper size instead of Letter for PostScript output. |
||||
*/ |
||||
#undef A4_PAPER |
||||
|
||||
/*
|
||||
* Do not allow text selection. |
||||
*/ |
||||
#undef NO_TEXT_SELECT |
||||
|
||||
/*
|
||||
* Include support for OPI comments. |
||||
*/ |
||||
#undef OPI_SUPPORT |
||||
|
||||
/*
|
||||
* Enable multithreading support. |
||||
*/ |
||||
#define MULTITHREADED 1 |
||||
|
||||
/*
|
||||
* Enable C++ exceptions. |
||||
*/ |
||||
#define USE_EXCEPTIONS 1 |
||||
|
||||
/*
|
||||
* Enable word list support. |
||||
*/ |
||||
#undef TEXTOUT_WORD_LIST |
||||
|
||||
/*
|
||||
* Use fixed point (instead of floating point) arithmetic. |
||||
*/ |
||||
#undef USE_FIXEDPOINT |
||||
|
||||
/*
|
||||
* Directory with the Xpdf app-defaults file. |
||||
*/ |
||||
#undef APPDEFDIR |
||||
|
||||
/*
|
||||
* Full path for the system-wide xpdfrc file. |
||||
*/ |
||||
#undef SYSTEM_XPDFRC |
||||
|
||||
/*
|
||||
* Various include files and functions. |
||||
*/ |
||||
#undef HAVE_DIRENT_H |
||||
#undef HAVE_SYS_NDIR_H |
||||
#undef HAVE_SYS_DIR_H |
||||
#undef HAVE_NDIR_H |
||||
#undef HAVE_SYS_SELECT_H |
||||
#undef HAVE_SYS_BSDTYPES_H |
||||
#undef HAVE_STRINGS_H |
||||
#undef HAVE_BSTRING_H |
||||
#undef HAVE_POPEN |
||||
#undef HAVE_MKSTEMP |
||||
#undef HAVE_MKSTEMPS |
||||
#undef SELECT_TAKES_INT |
||||
#define HAVE_STD_SORT 1 |
||||
#undef HAVE_FSEEKO |
||||
#undef HAVE_FSEEK64 |
||||
#undef _FILE_OFFSET_BITS |
||||
#undef _LARGE_FILES |
||||
#undef _LARGEFILE_SOURCE |
||||
#undef HAVE_XTAPPSETEXITFLAG |
||||
|
||||
/*
|
||||
* This is defined if using libXpm. |
||||
*/ |
||||
#undef HAVE_X11_XPM_H |
||||
|
||||
/*
|
||||
* This is defined if using t1lib. |
||||
*/ |
||||
#undef HAVE_T1LIB_H |
||||
|
||||
/*
|
||||
* One of these is defined if using FreeType (version 1 or 2). |
||||
*/ |
||||
#undef HAVE_FREETYPE_H |
||||
#define HAVE_FREETYPE_FREETYPE_H 1 |
||||
|
||||
/*
|
||||
* This is defined if using FreeType version 2. |
||||
*/ |
||||
#define FREETYPE2 |
||||
|
||||
/*
|
||||
* This is defined if using libpaper. |
||||
*/ |
||||
#undef HAVE_PAPER_H |
||||
|
||||
/*
|
||||
* Enable support for loading plugins. |
||||
*/ |
||||
#undef ENABLE_PLUGINS |
||||
|
||||
/*
|
||||
* Defined if the Splash library is avaiable. |
||||
*/ |
||||
#undef HAVE_SPLASH |
||||
|
||||
/*
|
||||
* Enable support for CMYK output. |
||||
*/ |
||||
#undef SPLASH_CMYK |
||||
|
||||
#endif |
@ -1,116 +0,0 @@ |
||||
/*
|
||||
* aconf.h |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF_H |
||||
#define ACONF_H |
||||
|
||||
#include <aconf2.h> |
||||
|
||||
/*
|
||||
* Use A4 paper size instead of Letter for PostScript output. |
||||
*/ |
||||
#undef A4_PAPER |
||||
|
||||
/*
|
||||
* Do not allow text selection. |
||||
*/ |
||||
#undef NO_TEXT_SELECT |
||||
|
||||
/*
|
||||
* Include support for OPI comments. |
||||
*/ |
||||
#undef OPI_SUPPORT |
||||
|
||||
/*
|
||||
* Enable multithreading support. |
||||
*/ |
||||
#undef MULTITHREADED |
||||
|
||||
/*
|
||||
* Enable C++ exceptions. |
||||
*/ |
||||
#undef USE_EXCEPTIONS |
||||
|
||||
/*
|
||||
* Enable word list support. |
||||
*/ |
||||
#undef TEXTOUT_WORD_LIST |
||||
|
||||
/*
|
||||
* Use fixed point (instead of floating point) arithmetic. |
||||
*/ |
||||
#undef USE_FIXEDPOINT |
||||
|
||||
/*
|
||||
* Directory with the Xpdf app-defaults file. |
||||
*/ |
||||
#undef APPDEFDIR |
||||
|
||||
/*
|
||||
* Full path for the system-wide xpdfrc file. |
||||
*/ |
||||
#undef SYSTEM_XPDFRC |
||||
|
||||
/*
|
||||
* Various include files and functions. |
||||
*/ |
||||
#undef HAVE_DIRENT_H |
||||
#undef HAVE_SYS_NDIR_H |
||||
#undef HAVE_SYS_DIR_H |
||||
#undef HAVE_NDIR_H |
||||
#undef HAVE_SYS_SELECT_H |
||||
#undef HAVE_SYS_BSDTYPES_H |
||||
#undef HAVE_STRINGS_H |
||||
#undef HAVE_BSTRING_H |
||||
#undef HAVE_POPEN |
||||
#undef HAVE_MKSTEMP |
||||
#undef HAVE_MKSTEMPS |
||||
#undef SELECT_TAKES_INT |
||||
#undef HAVE_STD_SORT |
||||
#undef HAVE_FSEEKO |
||||
#undef HAVE_FSEEK64 |
||||
#undef _FILE_OFFSET_BITS |
||||
#undef _LARGE_FILES |
||||
#undef _LARGEFILE_SOURCE |
||||
#undef HAVE_XTAPPSETEXITFLAG |
||||
|
||||
/*
|
||||
* This is defined if using libXpm. |
||||
*/ |
||||
#undef HAVE_X11_XPM_H |
||||
|
||||
/*
|
||||
* This is defined if using t1lib. |
||||
*/ |
||||
#undef HAVE_T1LIB_H |
||||
|
||||
/*
|
||||
* One of these is defined if using FreeType 2. |
||||
*/ |
||||
#undef HAVE_FREETYPE_H |
||||
#undef HAVE_FREETYPE_FREETYPE_H |
||||
|
||||
/*
|
||||
* This is defined if using libpaper. |
||||
*/ |
||||
#undef HAVE_PAPER_H |
||||
|
||||
/*
|
||||
* Enable support for loading plugins. |
||||
*/ |
||||
#undef ENABLE_PLUGINS |
||||
|
||||
/*
|
||||
* Defined if the Splash library is avaiable. |
||||
*/ |
||||
#undef HAVE_SPLASH |
||||
|
||||
/*
|
||||
* Enable support for CMYK output. |
||||
*/ |
||||
#undef SPLASH_CMYK |
||||
|
||||
#endif |
@ -1,38 +0,0 @@ |
||||
/*
|
||||
* aconf2.h |
||||
* |
||||
* This gets included by aconf.h, and contains miscellaneous global |
||||
* settings not directly controlled by autoconf. This is a separate |
||||
* file because otherwise the configure script will munge any |
||||
* #define/#undef constructs. |
||||
* |
||||
* Copyright 2002-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef ACONF2_H |
||||
#define ACONF2_H |
||||
|
||||
/*
|
||||
* This controls the use of the interface/implementation pragmas. |
||||
*/ |
||||
#ifdef __GNUC__ |
||||
#define USE_GCC_PRAGMAS |
||||
#endif |
||||
/* There is a bug in the version of gcc which ships with MacOS X 10.2 */ |
||||
#if defined(__APPLE__) && defined(__MACH__) |
||||
# include <AvailabilityMacros.h> |
||||
#endif |
||||
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED |
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 |
||||
# undef USE_GCC_PRAGMAS |
||||
# endif |
||||
#endif |
||||
|
||||
/*
|
||||
* Make sure WIN32 is defined if appropriate. |
||||
*/ |
||||
#if defined(_WIN32) && !defined(WIN32) |
||||
# define WIN32 |
||||
#endif |
||||
|
||||
#endif |
File diff suppressed because it is too large
Load Diff
@ -1,368 +0,0 @@ |
||||
dnl Process this file with autoconf to produce a configure script. |
||||
dnl Copyright 1998-2005 Glyph & Cog, LLC |
||||
|
||||
AC_PREREQ(2.57) |
||||
|
||||
AC_INIT(xpdf/xpdf.cc) |
||||
AC_CONFIG_HEADER(aconf.h) |
||||
|
||||
dnl ##### Optional features. |
||||
AC_ARG_ENABLE(a4-paper, |
||||
[ --enable-a4-paper use A4 paper size instead of Letter for |
||||
PostScript output], |
||||
AC_DEFINE(A4_PAPER)) |
||||
AC_ARG_ENABLE(no-text-select, |
||||
[ --enable-no-text-select do not allow text selection], |
||||
AC_DEFINE(NO_TEXT_SELECT)) |
||||
AC_ARG_ENABLE(opi, |
||||
[ --enable-opi include support for OPI comments], |
||||
AC_DEFINE(OPI_SUPPORT)) |
||||
AC_ARG_ENABLE(multithreaded, |
||||
[ --enable-multithreaded include support for multithreading], |
||||
AC_DEFINE(MULTITHREADED)) |
||||
AC_ARG_ENABLE(exceptions, |
||||
[ --enable-exceptions use C++ exceptions], |
||||
AC_DEFINE(USE_EXCEPTIONS)) |
||||
AC_ARG_ENABLE(wordlist, |
||||
[ --enable-wordlist include support for building word lists], |
||||
AC_DEFINE(TEXTOUT_WORD_LIST)) |
||||
AC_ARG_ENABLE(fixedpoint, |
||||
[ --enable-fixedpoint use fixed point (instead of floating point) arithmetic], |
||||
AC_DEFINE(USE_FIXEDPOINT)) |
||||
AC_ARG_ENABLE(cmyk, |
||||
[ --enable-cmyk include support for CMYK rasterization], |
||||
AC_DEFINE(SPLASH_CMYK)) |
||||
AC_ARG_WITH(appdef-dir, |
||||
[ --with-appdef-dir set app-defaults directory], |
||||
AC_DEFINE_UNQUOTED(APPDEFDIR, "$with_appdef_dir")) |
||||
|
||||
dnl ##### Path to xpdfrc. |
||||
dnl This ugly kludge to get the sysconfdir path is needed because |
||||
dnl autoconf doesn't actually set the prefix variable until later. |
||||
if test "$sysconfdir" = '${prefix}/etc'; then |
||||
if test "x$prefix" = xNONE; then |
||||
system_xpdfrc="$ac_default_prefix/etc/xpdfrc" |
||||
else |
||||
system_xpdfrc="$prefix/etc/xpdfrc" |
||||
fi |
||||
else |
||||
system_xpdfrc="$sysconfdir/xpdfrc" |
||||
fi |
||||
AC_DEFINE_UNQUOTED(SYSTEM_XPDFRC, "$system_xpdfrc") |
||||
|
||||
dnl ##### Checks for programs. |
||||
AC_PROG_CC |
||||
AC_ISC_POSIX |
||||
AC_PROG_CC_STDC |
||||
#if test -z "$CXX" -a "$CC" = "gcc"; then |
||||
# CXX="gcc" |
||||
#fi |
||||
AC_PROG_CXX |
||||
AC_PROG_INSTALL |
||||
AC_PROG_RANLIB |
||||
|
||||
dnl ##### Default values for Unix. |
||||
EXE="" |
||||
LIBPREFIX="lib" |
||||
AR="ar rc" |
||||
UP_DIR="" |
||||
|
||||
dnl ##### Check for OS/2. |
||||
AC_CACHE_CHECK([for OS/2 (with EMX)], |
||||
xpdf_cv_sys_os2, |
||||
[AC_TRY_COMPILE([], |
||||
[__EMX__], |
||||
xpdf_cv_sys_os2=yes, xpdf_cv_sys_os2=no)]) |
||||
if test "$xpdf_cv_sys_os2" = yes; then |
||||
EXE=".exe" |
||||
LIBPREFIX="" |
||||
AR="ar -rc" |
||||
fi |
||||
|
||||
dnl ##### Check for DOS (with DJGPP). |
||||
AC_CACHE_CHECK([for DOS (with DJGPP)], |
||||
xpdf_cv_sys_dos, |
||||
[AC_TRY_COMPILE([], |
||||
[__DJGPP__], |
||||
xpdf_cv_sys_dos=yes, xpdf_cv_sys_dos=no)]) |
||||
if test "$xpdf_cv_sys_dos" = yes; then |
||||
EXE=".exe" |
||||
LIBPREFIX="lib" |
||||
AR="ar -rc" |
||||
UP_DIR="../" |
||||
fi |
||||
|
||||
dnl ##### Do substitutions. |
||||
AC_SUBST(EXE) |
||||
AC_SUBST(LIBPREFIX) |
||||
AC_SUBST(AR) |
||||
AC_SUBST(UP_DIR) |
||||
|
||||
dnl ##### Checks for header files. |
||||
AC_PATH_XTRA |
||||
AC_HEADER_DIRENT |
||||
|
||||
dnl ##### Switch over to C++. This will make the checks below a little |
||||
dnl ##### bit stricter (requiring function prototypes in include files). |
||||
dnl ##### (99% of xpdf is written in C++.) |
||||
AC_LANG_CPLUSPLUS |
||||
|
||||
dnl ##### Check for extra libraries needed by X. (LynxOS needs this.) |
||||
AC_CHECK_FUNC(gethostbyname) |
||||
if test $ac_cv_func_gethostbyname = no; then |
||||
AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd") |
||||
fi |
||||
|
||||
dnl ##### Look for header that defines select() and fd_set. |
||||
AC_MSG_CHECKING([select() and fd_set in sys/select.h and sys/bsdtypes.h]) |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#include <unistd.h> |
||||
#include <sys/types.h>], |
||||
[fd_set fds; |
||||
select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_MSG_RESULT([not needed]) |
||||
else |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#include <unistd.h> |
||||
#include <sys/types.h> |
||||
#include <sys/select.h>], |
||||
[fd_set fds; |
||||
select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_DEFINE(HAVE_SYS_SELECT_H) |
||||
AC_MSG_RESULT([need sys/select.h]) |
||||
else |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#include <unistd.h> |
||||
#include <sys/types.h> |
||||
#include <sys/bsdtypes.h>], |
||||
[fd_set fds; |
||||
select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_DEFINE(HAVE_SYS_BSDTYPES_H) |
||||
AC_MSG_RESULT([need sys/bsdtypes.h]) |
||||
else |
||||
AC_MSG_RESULT([problem]) |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
dnl ##### Look for header that defines FD_ZERO. |
||||
AC_MSG_CHECKING([FD_ZERO and strings.h or bstring.h]) |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <sys/types.h> |
||||
#ifdef HAVE_SYS_SELECT_H |
||||
#include <sys/select.h> |
||||
#endif], |
||||
[fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_MSG_RESULT([not needed]) |
||||
else |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <sys/types.h> |
||||
#include <strings.h> |
||||
#ifdef HAVE_SYS_SELECT_H |
||||
#include <sys/select.h> |
||||
#endif], |
||||
[fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_DEFINE(HAVE_STRINGS_H) |
||||
AC_MSG_RESULT([need strings.h]) |
||||
else |
||||
AC_TRY_COMPILE([#include <stdlib.h> |
||||
#include <sys/types.h> |
||||
#include <bstring.h> |
||||
#ifdef HAVE_SYS_SELECT_H |
||||
#include <sys/select.h> |
||||
#endif], |
||||
[fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) |
||||
if test $xpdf_ok = yes; then |
||||
AC_DEFINE(HAVE_BSTRING_H) |
||||
AC_MSG_RESULT([need bstring.h]) |
||||
else |
||||
AC_MSG_RESULT([problem]) |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
dnl ##### Look for rewinddir. |
||||
AC_CHECK_FUNCS(rewinddir) |
||||
if test $ac_cv_func_rewinddir = no; then |
||||
AC_CHECK_LIB(cposix, rewinddir) |
||||
fi |
||||
|
||||
dnl ##### Checks for library functions. |
||||
AC_CHECK_FUNCS(popen) |
||||
dnl # This should use 'AC_CHECK_FUNCS(mkstemp)' but that fails if |
||||
dnl # the mkstemp exists in the library but isn't declared in the |
||||
dnl # include file (e.g., in cygwin 1.1.2). |
||||
AC_CACHE_CHECK([for mkstemp], |
||||
xpdf_cv_func_mkstemp, |
||||
[AC_TRY_LINK([#include <stdlib.h> |
||||
#include <unistd.h>], |
||||
[mkstemp("foo");], |
||||
xpdf_cv_func_mkstemp=yes, xpdf_cv_func_mkstemp=no)]) |
||||
if test "$xpdf_cv_func_mkstemp" = yes; then |
||||
AC_DEFINE(HAVE_MKSTEMP) |
||||
fi |
||||
dnl # Check for mkstemps, just like mkstemp. |
||||
AC_CACHE_CHECK([for mkstemps], |
||||
xpdf_cv_func_mkstemps, |
||||
[AC_TRY_LINK([#include <stdlib.h> |
||||
#include <unistd.h>], |
||||
[mkstemps("foo", 0);], |
||||
xpdf_cv_func_mkstemps=yes, xpdf_cv_func_mkstemps=no)]) |
||||
if test "$xpdf_cv_func_mkstemps" = yes; then |
||||
AC_DEFINE(HAVE_MKSTEMPS) |
||||
fi |
||||
|
||||
dnl ##### Check select argument type: on HP-UX before version 10, select |
||||
dnl ##### takes (int *) instead of (fd_set *). |
||||
AC_CACHE_CHECK([whether select takes fd_set arguments], |
||||
xpdf_cv_func_select_arg, |
||||
[AC_TRY_COMPILE([#include <sys/types.h> |
||||
#include <sys/time.h> |
||||
#include <unistd.h> |
||||
#ifdef HAVE_SYS_SELECT_H |
||||
#include <sys/select.h> |
||||
#endif], |
||||
[fd_set fds; |
||||
select(1, &fds, &fds, &fds, 0);], |
||||
xpdf_cv_func_select_arg=yes, xpdf_cv_func_select_arg=no)]) |
||||
if test "$xpdf_cv_func_select_arg" != yes; then |
||||
AC_DEFINE(SELECT_TAKES_INT) |
||||
fi |
||||
|
||||
dnl ##### Check for std::sort. |
||||
AC_CACHE_CHECK([for std::sort], |
||||
xpdf_cv_func_std_sort, |
||||
[AC_COMPILE_IFELSE( |
||||
AC_LANG_PROGRAM([[#include <algorithm> |
||||
struct functor { |
||||
bool operator()(const int &i0, const int &i1) { return i0 < i1; } |
||||
};]], |
||||
[[int a[[100]]; |
||||
std::sort(a, a+100, functor());]]), |
||||
xpdf_cv_func_std_sort=yes, xpdf_cv_func_std_sort=no)]) |
||||
if test "$xpdf_cv_func_std_sort" = yes; then |
||||
AC_DEFINE(HAVE_STD_SORT) |
||||
fi |
||||
|
||||
dnl ##### Back to C for the library tests. |
||||
AC_LANG_C |
||||
|
||||
dnl ##### Check for fseeko/ftello or fseek64/ftell64 |
||||
dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode. |
||||
AC_SYS_LARGEFILE |
||||
AC_FUNC_FSEEKO |
||||
AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no) |
||||
AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no) |
||||
if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then |
||||
AC_DEFINE(HAVE_FSEEK64) |
||||
fi |
||||
|
||||
dnl ##### Check for libXpm. |
||||
if test -z "$no_x"; then |
||||
smr_CHECK_LIB(Xpm, Xpm, [pixmap library - used only for icon], |
||||
XpmCreatePixmapFromData, X11/xpm.h, |
||||
$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS) |
||||
AC_SUBST(Xpm_LIBS) |
||||
AC_SUBST(Xpm_CFLAGS) |
||||
fi |
||||
|
||||
dnl ##### Check for Motif (libXm). |
||||
if test -z "$no_x"; then |
||||
dnl # XextAddDisplay isn't defined in any header file, so we provide a |
||||
dnl # bogus prototype (so the compiler doesn't complain) and a bogus |
||||
dnl # header file (so the smr macro doesn't break). |
||||
smr_CHECK_LIB(Xext, Xext, [Motif library], |
||||
XextAddDisplay, X11/Xlib.h, |
||||
$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS, |
||||
[int XextAddDisplay();]) |
||||
AC_SUBST(Xext_LIBS) |
||||
AC_SUBST(Xext_CFLAGS) |
||||
smr_CHECK_LIB(Xp, Xp, [Motif library], |
||||
XpStartPage, X11/extensions/Print.h, |
||||
$X_LIBS $X_PRE_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS) |
||||
AC_SUBST(Xp_LIBS) |
||||
AC_SUBST(Xp_CFLAGS) |
||||
smr_CHECK_LIB(Xt, Xt, [Motif library], |
||||
XtAppInitialize, X11/Intrinsic.h, |
||||
$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS) |
||||
AC_SUBST(Xt_LIBS) |
||||
AC_SUBST(Xt_CFLAGS) |
||||
smr_CHECK_LIB(Xm, Xm, [Motif library], |
||||
XmCreateForm, Xm/XmAll.h, |
||||
$Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS) |
||||
AC_SUBST(Xm_LIBS) |
||||
AC_SUBST(Xm_CFLAGS) |
||||
smr_CHECK_LIB(Sgm, Sgm, [SGI Motif library], |
||||
SgCreateHorzPanedWindow, Sgm/HPanedW.h, |
||||
$Xm_LIBS $Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS) |
||||
AC_SUBST(Sgm_LIBS) |
||||
AC_SUBST(Sgm_CFLAGS) |
||||
|
||||
dnl # check for XtAppSetExitFlag, which didn't exist prior to X11R6 (?) |
||||
if test "x$smr_have_Xt_library" = xyes; then |
||||
AC_CHECK_LIB(Xt, XtAppSetExitFlag, |
||||
AC_DEFINE(HAVE_XTAPPSETEXITFLAG), , |
||||
[$Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11]) |
||||
fi |
||||
fi |
||||
|
||||
dnl ##### Check for t1lib. |
||||
smr_CHECK_LIB(t1, t1, [Type 1 font rasterizer], |
||||
T1_InitLib, t1lib.h, |
||||
-lm, $X_CFLAGS) |
||||
AC_SUBST(t1_LIBS) |
||||
AC_SUBST(t1_CFLAGS) |
||||
|
||||
dnl ##### Check for FreeType 2.x. |
||||
dnl ##### (Note: FT_Get_Name_Index was added in FT 2.0.5, and is |
||||
dnl ##### the reason that Xpdf requires 2.0.5+.) |
||||
smr_CHECK_LIB(freetype2, freetype, [FreeType2 font rasterizer - version 2.0.5+], |
||||
FT_Get_Name_Index, ft2build.h, -lm) |
||||
AC_SUBST(freetype2_LIBS) |
||||
AC_SUBST(freetype2_CFLAGS) |
||||
if test "x$smr_have_freetype2_library" = xyes; then |
||||
AC_DEFINE(HAVE_FREETYPE_FREETYPE_H) |
||||
AC_DEFINE(HAVE_SPLASH) |
||||
fi |
||||
|
||||
dnl ##### Check for libpaper (Debian). |
||||
smr_CHECK_LIB(libpaper, paper, [Debian libpaper], paperinit, paper.h) |
||||
AC_SUBST(libpaper_LIBS) |
||||
AC_SUBST(libpaper_CFLAGS) |
||||
|
||||
dnl ##### Disable X-specific stuff in top-level Makefile. |
||||
if test -n "$no_x" -o "x$smr_have_Xm_library" != xyes -o "x$smr_have_freetype2_library" != xyes; then |
||||
X="#" |
||||
XPDF_TARGET="all-no-x" |
||||
else |
||||
X="" |
||||
XPDF_TARGET="all" |
||||
fi |
||||
AC_SUBST(X) |
||||
AC_SUBST(XPDF_TARGET) |
||||
|
||||
dnl ##### Write the makefiles. |
||||
AC_OUTPUT(Makefile goo/Makefile fofi/Makefile splash/Makefile xpdf/Makefile) |
||||
|
||||
dnl ##### Warn user if X is missing. |
||||
if test -n "$no_x" -o "x$smr_have_Xm_library" != xyes -o "x$smr_have_freetype2_library" != xyes; then |
||||
if test -n "$no_x"; then |
||||
AC_MSG_WARN([Couldn't find X]); |
||||
fi |
||||
if test "x$smr_have_Xm_library" != xyes; then |
||||
AC_MSG_WARN([Couldn't find Motif]); |
||||
fi |
||||
if test "x$smr_have_freetype2_library" != xyes; then |
||||
AC_MSG_WARN([Couldn't find FreeType]); |
||||
fi |
||||
AC_MSG_WARN([-- You will be able to compile pdftops, pdftotext, |
||||
pdfinfo, pdffonts, and pdfimages, but not xpdf or pdftoppm]) |
||||
fi |
@ -1,83 +0,0 @@ |
||||
set CC=gcc |
||||
set CFLAGS=-g -O2 -I.. -I..\fofi -I..\goo |
||||
set CXX=gpp |
||||
set CXXFLAGS=%CFLAGS% |
||||
set LIBPROG=ar |
||||
|
||||
copy aconf-dj.h aconf.h |
||||
|
||||
cd goo |
||||
%CXX% %CXXFLAGS% -c GHash.cc |
||||
%CXX% %CXXFLAGS% -c GList.cc |
||||
%CXX% %CXXFLAGS% -c GString.cc |
||||
%CXX% %CXXFLAGS% -c gmem.cc |
||||
%CXX% %CXXFLAGS% -c gmempp.cc |
||||
%CXX% %CXXFLAGS% -c gfile.cc |
||||
%CC% %CFLAGS% -c parseargs.c |
||||
del libGoo.a |
||||
%LIBPROG% -rc libGoo.a GHash.o GList.o GString.o gmempp.o gfile.o gmem.o parseargs.o |
||||
|
||||
cd ..\fofi |
||||
%CXX% %CXXFLAGS% -c FoFiBase.cc |
||||
%CXX% %CXXFLAGS% -c FoFiEncodings.cc |
||||
%CXX% %CXXFLAGS% -c FoFiIdentifier.cc |
||||
%CXX% %CXXFLAGS% -c FoFiTrueType.cc |
||||
%CXX% %CXXFLAGS% -c FoFiType1.cc |
||||
%CXX% %CXXFLAGS% -c FoFiType1C.cc |
||||
%LIBPROG% -rc libfofi.a FoFiBase.o FoFiEncodings.o FoFiIdentifier.o FoFiTrueType.o FoFiType1.o FoFiType1C.o |
||||
|
||||
cd ..\xpdf |
||||
del *.o |
||||
%CXX% %CXXFLAGS% -c Annot.cc |
||||
%CXX% %CXXFLAGS% -c Array.cc |
||||
%CXX% %CXXFLAGS% -c BuiltinFont.cc |
||||
%CXX% %CXXFLAGS% -c BuiltinFontTables.cc |
||||
%CXX% %CXXFLAGS% -c CMap.cc |
||||
%CXX% %CXXFLAGS% -c Catalog.cc |
||||
%CXX% %CXXFLAGS% -c CharCodeToUnicode.cc |
||||
%CXX% %CXXFLAGS% -c Decrypt.cc |
||||
%CXX% %CXXFLAGS% -c Dict.cc |
||||
%CXX% %CXXFLAGS% -c Error.cc |
||||
%CXX% %CXXFLAGS% -c FontEncodingTables.cc |
||||
%CXX% %CXXFLAGS% -c Function.cc |
||||
%CXX% %CXXFLAGS% -c Gfx.cc |
||||
%CXX% %CXXFLAGS% -c GfxFont.cc |
||||
%CXX% %CXXFLAGS% -c GfxState.cc |
||||
%CXX% %CXXFLAGS% -c GlobalParams.cc |
||||
%CXX% %CXXFLAGS% -c ImageOutputDev.cc |
||||
%CXX% %CXXFLAGS% -c JArithmeticDecoder.cc |
||||
%CXX% %CXXFLAGS% -c JBIG2Stream.cc |
||||
%CXX% %CXXFLAGS% -c JPXStream.cc |
||||
%CXX% %CXXFLAGS% -c Lexer.cc |
||||
%CXX% %CXXFLAGS% -c Link.cc |
||||
%CXX% %CXXFLAGS% -c NameToCharCode.cc |
||||
%CXX% %CXXFLAGS% -c Object.cc |
||||
%CXX% %CXXFLAGS% -c OptionalContent.cc |
||||
%CXX% %CXXFLAGS% -c Outline.cc |
||||
%CXX% %CXXFLAGS% -c OutputDev.cc |
||||
%CXX% %CXXFLAGS% -c PDFDoc.cc |
||||
%CXX% %CXXFLAGS% -c PDFDocEncoding.cc |
||||
%CXX% %CXXFLAGS% -c PSOutputDev.cc |
||||
%CXX% %CXXFLAGS% -c PSTokenizer.cc |
||||
%CXX% %CXXFLAGS% -c Page.cc |
||||
%CXX% %CXXFLAGS% -c Parser.cc |
||||
%CXX% %CXXFLAGS% -c SecurityHandler.cc |
||||
%CXX% %CXXFLAGS% -c Stream.cc |
||||
%CXX% %CXXFLAGS% -c TextOutputDev.cc |
||||
%CXX% %CXXFLAGS% -c UnicodeMap.cc |
||||
%CXX% %CXXFLAGS% -c UnicodeTypeTable.cc |
||||
%CXX% %CXXFLAGS% -c XRef.cc |
||||
del libxpdf.a |
||||
%LIBPROG% -rc libxpdf.a *.o |
||||
|
||||
%CXX% %CXXFLAGS% -o pdftops.exe pdftops.cc libxpdf.a ..\fofi\libfofi.a ..\goo\libGoo.a |
||||
|
||||
%CXX% %CXXFLAGS% -o pdftotext.exe pdftotext.cc libxpdf.a ..\fofi\libfofi.a ..\goo\libGoo.a |
||||
|
||||
%CXX% %CXXFLAGS% -o pdfinfo.exe pdfinfo.cc libxpdf.a ..\fofi\libfofi.a ..\goo\libGoo.a |
||||
|
||||
%CXX% %CXXFLAGS% -o pdffonts.exe pdffonts.cc libxpdf.a ..\fofi\libfofi.a ..\goo\libGoo.a |
||||
|
||||
%CXX% %CXXFLAGS% -o pdfimages.exe pdfimages.cc libxpdf.a ..\fofi\libfofi.a ..\goo\libGoo.a |
||||
|
||||
cd .. |
@ -1,142 +0,0 @@ |
||||
.\" Copyright 1999-2007 Glyph & Cog, LLC |
||||
.TH pdffonts 1 "27 February 2007" |
||||
.SH NAME |
||||
pdffonts \- Portable Document Format (PDF) font analyzer (version |
||||
3.02) |
||||
.SH SYNOPSIS |
||||
.B pdffonts |
||||
[options] |
||||
.RI [ PDF-file ] |
||||
.SH DESCRIPTION |
||||
.B Pdffonts |
||||
lists the fonts used in a Portable Document Format (PDF) file along |
||||
with various information for each font. |
||||
.PP |
||||
The following information is listed for each font: |
||||
.TP |
||||
.B name |
||||
the font name, exactly as given in the PDF file (potentially including |
||||
a subset prefix) |
||||
.TP |
||||
.B type |
||||
the font type -- see below for details |
||||
.TP |
||||
.B emb |
||||
"yes" if the font is embedded in the PDF file |
||||
.TP |
||||
.B sub |
||||
"yes" if the font is a subset |
||||
.TP |
||||
.B uni |
||||
"yes" if there is an explicit "ToUnicode" map in the PDF file (the |
||||
absence of a ToUnicode map doesn't necessarily mean that the text |
||||
can't be converted to Unicode) |
||||
.TP |
||||
.B object ID |
||||
the font dictionary object ID (number and generation) |
||||
.PP |
||||
PDF files can contain the following types of fonts: |
||||
.PP |
||||
.RS |
||||
Type 1 |
||||
.RE |
||||
.RS |
||||
Type 1C -- aka Compact Font Format (CFF) |
||||
.RE |
||||
.RS |
||||
Type 1C (OT) -- OpenType with 8-bit CFF data |
||||
.RE |
||||
.RS |
||||
Type 3 |
||||
.RE |
||||
.RS |
||||
TrueType |
||||
.RE |
||||
.RS |
||||
TrueType (OT) -- OpenType with 8-bit TrueType data |
||||
.RE |
||||
.RS |
||||
CID Type 0 -- 16-bit font with no specified type |
||||
.RE |
||||
.RS |
||||
CID Type 0C -- 16-bit PostScript CFF font |
||||
.RE |
||||
.RS |
||||
CID Type 0C (OT) -- OpenType with CID CFF data |
||||
.RE |
||||
.RS |
||||
CID TrueType -- 16-bit TrueType font |
||||
.RE |
||||
.RS |
||||
CID TrueType (OT) -- OpenType with CID TrueType data |
||||
.RE |
||||
.SH CONFIGURATION FILE |
||||
Pdffonts reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't |
||||
exist, it looks for a system-wide config file, typically |
||||
/usr/local/etc/xpdfrc (but this location can be changed when pdffonts |
||||
is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to analyze. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to analyze. |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.BI \-cfg " config-file" |
||||
Read |
||||
.I config-file |
||||
in place of ~/.xpdfrc or the system-wide config file. |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdffonts software and documentation are copyright 1996-2007 Glyph |
||||
& Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,104 +0,0 @@ |
||||
pdffonts(1) pdffonts(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdffonts - Portable Document Format (PDF) font analyzer (version 3.02) |
||||
|
||||
SYNOPSIS |
||||
pdffonts [options] [PDF-file] |
||||
|
||||
DESCRIPTION |
||||
Pdffonts lists the fonts used in a Portable Document Format (PDF) file |
||||
along with various information for each font. |
||||
|
||||
The following information is listed for each font: |
||||
|
||||
name the font name, exactly as given in the PDF file (potentially |
||||
including a subset prefix) |
||||
|
||||
type the font type -- see below for details |
||||
|
||||
emb "yes" if the font is embedded in the PDF file |
||||
|
||||
sub "yes" if the font is a subset |
||||
|
||||
uni "yes" if there is an explicit "ToUnicode" map in the PDF file |
||||
(the absence of a ToUnicode map doesn't necessarily mean that |
||||
the text can't be converted to Unicode) |
||||
|
||||
object ID |
||||
the font dictionary object ID (number and generation) |
||||
|
||||
PDF files can contain the following types of fonts: |
||||
|
||||
Type 1 |
||||
Type 1C -- aka Compact Font Format (CFF) |
||||
Type 1C (OT) -- OpenType with 8-bit CFF data |
||||
Type 3 |
||||
TrueType |
||||
TrueType (OT) -- OpenType with 8-bit TrueType data |
||||
CID Type 0 -- 16-bit font with no specified type |
||||
CID Type 0C -- 16-bit PostScript CFF font |
||||
CID Type 0C (OT) -- OpenType with CID CFF data |
||||
CID TrueType -- 16-bit TrueType font |
||||
CID TrueType (OT) -- OpenType with CID TrueType data |
||||
|
||||
CONFIGURATION FILE |
||||
Pdffonts reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdffonts is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to analyze. |
||||
|
||||
-l number |
||||
Specifies the last page to analyze. |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdffonts software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 pdffonts(1) |
@ -1,114 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdffonts |
||||
|
||||
pdffonts - Portable Document Format (PDF) font analyzer (version |
||||
|
||||
pdffonts [options] [PDF-file] |
||||
|
||||
Pdffonts lists the fonts used in a Portable Document Format (PDF) file |
||||
along with various information for each font. |
||||
|
||||
The following information is listed for each font: |
||||
|
||||
name the font name, exactly as given in the PDF file (potentially |
||||
including a subset prefix) |
||||
|
||||
type the font type -- see below for details |
||||
|
||||
emb "yes" if the font is embedded in the PDF file |
||||
|
||||
sub "yes" if the font is a subset |
||||
|
||||
uni "yes" if there is an explicit "ToUnicode" map in the PDF file |
||||
(the absence of a ToUnicode map doesn't necessarily mean that |
||||
the text can't be converted to Unicode) |
||||
|
||||
object ID |
||||
the font dictionary object ID (number and generation) |
||||
|
||||
PDF files can contain the following types of fonts: |
||||
|
||||
Type 1 |
||||
Type 1C -- aka Compact Font Format (CFF) |
||||
Type 1C (OT) -- OpenType with 8-bit CFF data |
||||
Type 3 |
||||
TrueType |
||||
TrueType (OT) -- OpenType with 8-bit TrueType data |
||||
CID Type 0 -- 16-bit font with no specified type |
||||
CID Type 0C -- 16-bit PostScript CFF font |
||||
CID Type 0C (OT) -- OpenType with CID CFF data |
||||
CID TrueType -- 16-bit TrueType font |
||||
CID TrueType (OT) -- OpenType with CID TrueType data |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdffonts reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdffonts is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to analyze. |
||||
|
||||
-l number |
||||
Specifies the last page to analyze. |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdffonts software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,102 +0,0 @@ |
||||
.\" Copyright 1998-2007 Glyph & Cog, LLC |
||||
.TH pdfimages 1 "27 February 2007" |
||||
.SH NAME |
||||
pdfimages \- Portable Document Format (PDF) image extractor |
||||
(version 3.02) |
||||
.SH SYNOPSIS |
||||
.B pdfimages |
||||
[options] |
||||
.I PDF-file image-root |
||||
.SH DESCRIPTION |
||||
.B Pdfimages |
||||
saves images from a Portable Document Format (PDF) file as Portable |
||||
Pixmap (PPM), Portable Bitmap (PBM), or JPEG files. |
||||
.PP |
||||
Pdfimages reads the PDF file, scans one or more pages, |
||||
.IR PDF-file , |
||||
and writes one PPM, PBM, or JPEG file for each image, |
||||
.IR image-root - nnn . xxx , |
||||
where |
||||
.I nnn |
||||
is the image number and |
||||
.I xxx |
||||
is the image type (.ppm, .pbm, .jpg). |
||||
.PP |
||||
NB: pdfimages extracts the raw image data from the PDF file, without |
||||
performing any additional transforms. Any rotation, clipping, |
||||
color inversion, etc. done by the PDF content stream is ignored. |
||||
.SH CONFIGURATION FILE |
||||
Pdfimages reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't |
||||
exist, it looks for a system-wide config file, typically |
||||
/usr/local/etc/xpdfrc (but this location can be changed when pdfimages |
||||
is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to scan. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to scan. |
||||
.TP |
||||
.B \-j |
||||
Normally, all images are written as PBM (for monochrome images) or PPM |
||||
(for non-monochrome images) files. With this option, images in DCT |
||||
format are saved as JPEG files. All non-DCT images are saved in |
||||
PBM/PPM format as usual. |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.B \-q |
||||
Don't print any messages or errors. |
||||
.RB "[config file: " errQuiet ] |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdfimages software and documentation are copyright 1998-2007 Glyph |
||||
& Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdffonts (1), |
||||
.BR pdftoppm (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,85 +0,0 @@ |
||||
pdfimages(1) pdfimages(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdfimages - Portable Document Format (PDF) image extractor (version |
||||
3.02) |
||||
|
||||
SYNOPSIS |
||||
pdfimages [options] PDF-file image-root |
||||
|
||||
DESCRIPTION |
||||
Pdfimages saves images from a Portable Document Format (PDF) file as |
||||
Portable Pixmap (PPM), Portable Bitmap (PBM), or JPEG files. |
||||
|
||||
Pdfimages reads the PDF file, scans one or more pages, PDF-file, and |
||||
writes one PPM, PBM, or JPEG file for each image, image-root-nnn.xxx, |
||||
where nnn is the image number and xxx is the image type (.ppm, .pbm, |
||||
.jpg). |
||||
|
||||
NB: pdfimages extracts the raw image data from the PDF file, without |
||||
performing any additional transforms. Any rotation, clipping, color |
||||
inversion, etc. done by the PDF content stream is ignored. |
||||
|
||||
CONFIGURATION FILE |
||||
Pdfimages reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't exist, |
||||
it looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdfimages is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to scan. |
||||
|
||||
-l number |
||||
Specifies the last page to scan. |
||||
|
||||
-j Normally, all images are written as PBM (for monochrome images) |
||||
or PPM (for non-monochrome images) files. With this option, |
||||
images in DCT format are saved as JPEG files. All non-DCT |
||||
images are saved in PBM/PPM format as usual. |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdfimages software and documentation are copyright 1998-2007 Glyph |
||||
& Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), |
||||
pdftoppm(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 pdfimages(1) |
@ -1,94 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdfimages |
||||
|
||||
pdfimages - Portable Document Format (PDF) image extractor |
||||
|
||||
pdfimages [options] PDF-file image-root |
||||
|
||||
Pdfimages saves images from a Portable Document Format (PDF) file as |
||||
Portable Pixmap (PPM), Portable Bitmap (PBM), or JPEG files. |
||||
|
||||
Pdfimages reads the PDF file, scans one or more pages, PDF-file, and |
||||
writes one PPM, PBM, or JPEG file for each image, image-root-nnn.xxx, |
||||
where nnn is the image number and xxx is the image type (.ppm, .pbm, |
||||
.jpg). |
||||
|
||||
NB: pdfimages extracts the raw image data from the PDF file, without |
||||
performing any additional transforms. Any rotation, clipping, color |
||||
inversion, etc. done by the PDF content stream is ignored. |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdfimages reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't exist, |
||||
it looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdfimages is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to scan. |
||||
|
||||
-l number |
||||
Specifies the last page to scan. |
||||
|
||||
-j Normally, all images are written as PBM (for monochrome images) |
||||
or PPM (for non-monochrome images) files. With this option, |
||||
images in DCT format are saved as JPEG files. All non-DCT |
||||
images are saved in PBM/PPM format as usual. |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdfimages software and documentation are copyright 1998-2007 Glyph |
||||
& Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), |
||||
pdftoppm(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,161 +0,0 @@ |
||||
.\" Copyright 1999-2007 Glyph & Cog, LLC |
||||
.TH pdfinfo 1 "27 February 2007" |
||||
.SH NAME |
||||
pdfinfo \- Portable Document Format (PDF) document information |
||||
extractor (version 3.02) |
||||
.SH SYNOPSIS |
||||
.B pdfinfo |
||||
[options] |
||||
.RI [ PDF-file ] |
||||
.SH DESCRIPTION |
||||
.B Pdfinfo |
||||
prints the contents of the \'Info' dictionary (plus some other useful |
||||
information) from a Portable Document Format (PDF) file. |
||||
.PP |
||||
The \'Info' dictionary contains the following values: |
||||
.PP |
||||
.RS |
||||
title |
||||
.RE |
||||
.RS |
||||
subject |
||||
.RE |
||||
.RS |
||||
keywords |
||||
.RE |
||||
.RS |
||||
author |
||||
.RE |
||||
.RS |
||||
creator |
||||
.RE |
||||
.RS |
||||
producer |
||||
.RE |
||||
.RS |
||||
creation date |
||||
.RE |
||||
.RS |
||||
modification date |
||||
.RE |
||||
.PP |
||||
In addition, the following information is printed: |
||||
.PP |
||||
.RS |
||||
tagged (yes/no) |
||||
.RE |
||||
.RS |
||||
form (AcroForm / XFA / none) |
||||
.RE |
||||
.RS |
||||
page count |
||||
.RE |
||||
.RS |
||||
encrypted flag (yes/no) |
||||
.RE |
||||
.RS |
||||
print and copy permissions (if encrypted) |
||||
.RE |
||||
.RS |
||||
page size |
||||
.RE |
||||
.RS |
||||
file size |
||||
.RE |
||||
.RS |
||||
linearized (yes/no) |
||||
.RE |
||||
.RS |
||||
PDF version |
||||
.RE |
||||
.RS |
||||
metadata (only if requested) |
||||
.RE |
||||
.SH CONFIGURATION FILE |
||||
Pdfinfo reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdfinfo is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to examine. If multiple pages are requested |
||||
using the "-f" and "-l" options, the size of each requested page (and, |
||||
optionally, the bounding boxes for each requested page) are printed. |
||||
Otherwise, only page one is examined. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to examine. |
||||
.TP |
||||
.B \-box |
||||
Prints the page box bounding boxes: MediaBox, CropBox, BleedBox, |
||||
TrimBox, and ArtBox. |
||||
.TP |
||||
.B \-meta |
||||
Prints document-level metadata. (This is the "Metadata" stream from |
||||
the PDF file's Catalog object.) |
||||
.TP |
||||
.BI \-enc " encoding-name" |
||||
Sets the encoding to use for text output. The |
||||
.I encoding\-name |
||||
must be defined with the unicodeMap command (see |
||||
.BR xpdfrc (5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). |
||||
.RB "[config file: " textEncoding ] |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.BI \-cfg " config-file" |
||||
Read |
||||
.I config-file |
||||
in place of ~/.xpdfrc or the system-wide config file. |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdfinfo software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdffonts (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,113 +0,0 @@ |
||||
pdfinfo(1) pdfinfo(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdfinfo - Portable Document Format (PDF) document information extractor |
||||
(version 3.02) |
||||
|
||||
SYNOPSIS |
||||
pdfinfo [options] [PDF-file] |
||||
|
||||
DESCRIPTION |
||||
Pdfinfo prints the contents of the 'Info' dictionary (plus some other |
||||
useful information) from a Portable Document Format (PDF) file. |
||||
|
||||
The 'Info' dictionary contains the following values: |
||||
|
||||
title |
||||
subject |
||||
keywords |
||||
author |
||||
creator |
||||
producer |
||||
creation date |
||||
modification date |
||||
|
||||
In addition, the following information is printed: |
||||
|
||||
tagged (yes/no) |
||||
form (AcroForm / XFA / none) |
||||
page count |
||||
encrypted flag (yes/no) |
||||
print and copy permissions (if encrypted) |
||||
page size |
||||
file size |
||||
linearized (yes/no) |
||||
PDF version |
||||
metadata (only if requested) |
||||
|
||||
CONFIGURATION FILE |
||||
Pdfinfo reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdfinfo is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to examine. If multiple pages are |
||||
requested using the "-f" and "-l" options, the size of each |
||||
requested page (and, optionally, the bounding boxes for each |
||||
requested page) are printed. Otherwise, only page one is exam- |
||||
ined. |
||||
|
||||
-l number |
||||
Specifies the last page to examine. |
||||
|
||||
-box Prints the page box bounding boxes: MediaBox, CropBox, BleedBox, |
||||
TrimBox, and ArtBox. |
||||
|
||||
-meta Prints document-level metadata. (This is the "Metadata" stream |
||||
from the PDF file's Catalog object.) |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). [con- |
||||
fig file: textEncoding] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdfinfo software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdftotext(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 pdfinfo(1) |
@ -1,122 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdfinfo |
||||
|
||||
pdfinfo - Portable Document Format (PDF) document information |
||||
|
||||
pdfinfo [options] [PDF-file] |
||||
|
||||
Pdfinfo prints the contents of the 'Info' dictionary (plus some other |
||||
useful information) from a Portable Document Format (PDF) file. |
||||
|
||||
The 'Info' dictionary contains the following values: |
||||
|
||||
title |
||||
subject |
||||
keywords |
||||
author |
||||
creator |
||||
producer |
||||
creation date |
||||
modification date |
||||
|
||||
In addition, the following information is printed: |
||||
|
||||
tagged (yes/no) |
||||
form (AcroForm / XFA / none) |
||||
page count |
||||
encrypted flag (yes/no) |
||||
print and copy permissions (if encrypted) |
||||
page size |
||||
file size |
||||
linearized (yes/no) |
||||
PDF version |
||||
metadata (only if requested) |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdfinfo reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdfinfo is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to examine. If multiple pages are |
||||
requested using the "-f" and "-l" options, the size of each |
||||
requested page (and, optionally, the bounding boxes for each |
||||
requested page) are printed. Otherwise, only page one is exam- |
||||
ined. |
||||
|
||||
-l number |
||||
Specifies the last page to examine. |
||||
|
||||
-box Prints the page box bounding boxes: MediaBox, CropBox, BleedBox, |
||||
TrimBox, and ArtBox. |
||||
|
||||
-meta Prints document-level metadata. (This is the "Metadata" stream |
||||
from the PDF file's Catalog object.) |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). [con- |
||||
fig file: textEncoding] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdfinfo software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdftotext(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,123 +0,0 @@ |
||||
.\" Copyright 2005-2007 Glyph & Cog, LLC |
||||
.TH pdftoppm 1 "27 February 2007" |
||||
.SH NAME |
||||
pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM) |
||||
converter (version 3.02) |
||||
.SH SYNOPSIS |
||||
.B pdftoppm |
||||
[options] |
||||
.I PDF-file PPM-root |
||||
.SH DESCRIPTION |
||||
.B Pdftoppm |
||||
converts Portable Document Format (PDF) files to color image files in |
||||
Portable Pixmap (PPM) format, grayscale image files in Portable |
||||
Graymap (PGM) format, or monochrome image files in Portable Bitmap |
||||
(PBM) format. |
||||
.PP |
||||
Pdftoppm reads the PDF file, |
||||
.IR PDF-file , |
||||
and writes one PPM file for each page, |
||||
.IR PPM-root - nnnnnn .ppm, |
||||
where |
||||
.I nnnnnn |
||||
is the page number. |
||||
If |
||||
.I PPM-root |
||||
is \'-', the image is sent to stdout (this is probably only useful |
||||
when converting a single page). |
||||
.SH CONFIGURATION FILE |
||||
Pdftoppm reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't |
||||
exist, it looks for a system-wide config file, typically |
||||
/usr/local/etc/xpdfrc (but this location can be changed when pdftoppm |
||||
is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to convert. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to convert. |
||||
.TP |
||||
.BI \-r " number" |
||||
Specifies the resolution, in DPI. The default is 150 DPI. |
||||
.TP |
||||
.B \-mono |
||||
Generate a monochrome PBM file (instead of a color PPM file). |
||||
.TP |
||||
.B \-gray |
||||
Generate a grayscale PGM file (instead of a color PPM file). |
||||
.TP |
||||
.BI \-t1lib " yes | no" |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This defaults to |
||||
"yes". |
||||
.RB "[config file: " enableT1lib ] |
||||
.TP |
||||
.BI \-freetype " yes | no" |
||||
Enable or disable FreeType (a TrueType / Type 1 font rasterizer). |
||||
This defaults to "yes". |
||||
.RB "[config file: " enableFreeType ] |
||||
.TP |
||||
.BI \-aa " yes | no" |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
.RB "[config file: " antialias ] |
||||
.TP |
||||
.BI \-aaVector " yes | no" |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
.RB "[config file: " vectorAntialias ] |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.B \-q |
||||
Don't print any messages or errors. |
||||
.RB "[config file: " errQuiet ] |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdftoppm software and documentation are copyright 1996-2007 Glyph |
||||
& Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdffonts (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,101 +0,0 @@ |
||||
pdftoppm(1) pdftoppm(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) con- |
||||
verter (version 3.02) |
||||
|
||||
SYNOPSIS |
||||
pdftoppm [options] PDF-file PPM-root |
||||
|
||||
DESCRIPTION |
||||
Pdftoppm converts Portable Document Format (PDF) files to color image |
||||
files in Portable Pixmap (PPM) format, grayscale image files in Porta- |
||||
ble Graymap (PGM) format, or monochrome image files in Portable Bitmap |
||||
(PBM) format. |
||||
|
||||
Pdftoppm reads the PDF file, PDF-file, and writes one PPM file for each |
||||
page, PPM-root-nnnnnn.ppm, where nnnnnn is the page number. If PPM- |
||||
root is '-', the image is sent to stdout (this is probably only useful |
||||
when converting a single page). |
||||
|
||||
CONFIGURATION FILE |
||||
Pdftoppm reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftoppm is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to convert. |
||||
|
||||
-l number |
||||
Specifies the last page to convert. |
||||
|
||||
-r number |
||||
Specifies the resolution, in DPI. The default is 150 DPI. |
||||
|
||||
-mono Generate a monochrome PBM file (instead of a color PPM file). |
||||
|
||||
-gray Generate a grayscale PGM file (instead of a color PPM file). |
||||
|
||||
-t1lib yes | no |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This |
||||
defaults to "yes". [config file: enableT1lib] |
||||
|
||||
-freetype yes | no |
||||
Enable or disable FreeType (a TrueType / Type 1 font raster- |
||||
izer). This defaults to "yes". [config file: enableFreeType] |
||||
|
||||
-aa yes | no |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
[config file: antialias] |
||||
|
||||
-aaVector yes | no |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
[config file: vectorAntialias] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdftoppm software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 pdftoppm(1) |
@ -1,110 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdftoppm |
||||
|
||||
pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) |
||||
|
||||
pdftoppm [options] PDF-file PPM-root |
||||
|
||||
Pdftoppm converts Portable Document Format (PDF) files to color image |
||||
files in Portable Pixmap (PPM) format, grayscale image files in Porta- |
||||
ble Graymap (PGM) format, or monochrome image files in Portable Bitmap |
||||
(PBM) format. |
||||
|
||||
Pdftoppm reads the PDF file, PDF-file, and writes one PPM file for each |
||||
page, PPM-root-nnnnnn.ppm, where nnnnnn is the page number. If PPM- |
||||
root is '-', the image is sent to stdout (this is probably only useful |
||||
when converting a single page). |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdftoppm reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftoppm is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to convert. |
||||
|
||||
-l number |
||||
Specifies the last page to convert. |
||||
|
||||
-r number |
||||
Specifies the resolution, in DPI. The default is 150 DPI. |
||||
|
||||
-mono Generate a monochrome PBM file (instead of a color PPM file). |
||||
|
||||
-gray Generate a grayscale PGM file (instead of a color PPM file). |
||||
|
||||
-t1lib yes | no |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This |
||||
defaults to "yes". [config file: enableT1lib] |
||||
|
||||
-freetype yes | no |
||||
Enable or disable FreeType (a TrueType / Type 1 font raster- |
||||
izer). This defaults to "yes". [config file: enableFreeType] |
||||
|
||||
-aa yes | no |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
[config file: antialias] |
||||
|
||||
-aaVector yes | no |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
[config file: vectorAntialias] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdftoppm software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,235 +0,0 @@ |
||||
.\" Copyright 1996-2007 Glyph & Cog, LLC |
||||
.TH pdftops 1 "27 February 2007" |
||||
.SH NAME |
||||
pdftops \- Portable Document Format (PDF) to PostScript converter |
||||
(version 3.02) |
||||
.SH SYNOPSIS |
||||
.B pdftops |
||||
[options] |
||||
.RI [ PDF-file |
||||
.RI [ PS-file ]] |
||||
.SH DESCRIPTION |
||||
.B Pdftops |
||||
converts Portable Document Format (PDF) files to PostScript so they |
||||
can be printed. |
||||
.PP |
||||
Pdftops reads the PDF file, |
||||
.IR PDF-file , |
||||
and writes a PostScript file, |
||||
.IR PS-file . |
||||
If |
||||
.I PS-file |
||||
is not specified, pdftops converts |
||||
.I file.pdf |
||||
to |
||||
.I file.ps |
||||
(or |
||||
.I file.eps |
||||
with the -eps option). If |
||||
.I PS-file |
||||
is \'-', the PostScript is sent to stdout. |
||||
.SH CONFIGURATION FILE |
||||
Pdftops reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftops is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to print. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to print. |
||||
.TP |
||||
.B \-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files will be |
||||
significantly larger (if they contain images), but will print on Level |
||||
1 printers. This also converts all images to black and white. No |
||||
more than one of the PostScript level options (-level1, -level1sep, |
||||
-level2, -level2sep, -level3, -level3Sep) may be given. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-level1sep |
||||
Generate Level 1 separable PostScript. All colors are converted to |
||||
CMYK. Images are written with separate stream data for the four |
||||
components. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-level2 |
||||
Generate Level 2 PostScript. Level 2 supports color images and image |
||||
compression. This is the default setting. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-level2sep |
||||
Generate Level 2 separable PostScript. All colors are converted to |
||||
CMYK. The PostScript separation convention operators are used to |
||||
handle custom (spot) colors. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-level3 |
||||
Generate Level 3 PostScript. This enables all Level 2 features plus |
||||
CID font embedding and masked image generation. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-level3Sep |
||||
Generate Level 3 separable PostScript. The separation handling is the |
||||
same as for -level2Sep. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.B \-eps |
||||
Generate an Encapsulated PostScript (EPS) file. An EPS file contains |
||||
a single image, so if you use this option with a multi-page PDF file, |
||||
you must use -f and -l to specify a single page. No more than one of |
||||
the mode options (-eps, -form) may be given. |
||||
.TP |
||||
.B \-form |
||||
Generate a PostScript form which can be imported by software that |
||||
understands forms. A form contains a single page, so if you use this |
||||
option with a multi-page PDF file, you must use -f and -l to specify a |
||||
single page. The -level1 option cannot be used with -form. |
||||
.TP |
||||
.B \-opi |
||||
Generate OPI comments for all images and forms which have OPI |
||||
information. (This option is only available if pdftops was compiled |
||||
with OPI support.) |
||||
.RB "[config file: " psOPI ] |
||||
.TP |
||||
.B \-noembt1 |
||||
By default, any Type 1 fonts which are embedded in the PDF file are |
||||
copied into the PostScript file. This option causes pdftops to |
||||
substitute base fonts instead. Embedded fonts make PostScript files |
||||
larger, but may be necessary for readable output. |
||||
.RB "[config file: " psEmbedType1Fonts ] |
||||
.TP |
||||
.B \-noembtt |
||||
By default, any TrueType fonts which are embedded in the PDF file are |
||||
copied into the PostScript file. This option causes pdftops to |
||||
substitute base fonts instead. Embedded fonts make PostScript files |
||||
larger, but may be necessary for readable output. Also, some |
||||
PostScript interpreters do not have TrueType rasterizers. |
||||
.RB "[config file: " psEmbedTrueTypeFonts ] |
||||
.TP |
||||
.B \-noembcidps |
||||
By default, any CID PostScript fonts which are embedded in the PDF |
||||
file are copied into the PostScript file. This option disables that |
||||
embedding. No attempt is made to substitute for non-embedded CID |
||||
PostScript fonts. |
||||
.RB "[config file: " psEmbedCIDPostScriptFonts ] |
||||
.TP |
||||
.B \-noembcidtt |
||||
By default, any CID TrueType fonts which are embedded in the PDF file |
||||
are copied into the PostScript file. This option disables that |
||||
embedding. No attempt is made to substitute for non-embedded CID |
||||
TrueType fonts. |
||||
.RB "[config file: " psEmbedCIDTrueTypeFonts ] |
||||
.TP |
||||
.B \-preload |
||||
Convert PDF forms to PS procedures, and preload image data. This uses |
||||
more memory in the PostScript interpreter, but generates significantly |
||||
smaller PS files in situations where, e.g., the same image is drawn on |
||||
every page of a long document. |
||||
.TP |
||||
.BI \-paper " size" |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". This |
||||
can also be set to "match", which will set the paper size to match the |
||||
size specified in the PDF file. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.BI \-paperw " size" |
||||
Set the paper width, in points. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.BI \-paperh " size" |
||||
Set the paper height, in points. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.B \-nocrop |
||||
By default, output is cropped to the CropBox specified in the PDF |
||||
file. This option disables cropping. |
||||
.RB "[config file: " psCrop ] |
||||
.TP |
||||
.B \-expand |
||||
Expand PDF pages smaller than the paper to fill the paper. By |
||||
default, these pages are not scaled. |
||||
.RB "[config file: " psExpandSmaller ] |
||||
.TP |
||||
.B \-noshrink |
||||
Don't scale PDF pages which are larger than the paper. By default, |
||||
pages larger than the paper are shrunk to fit. |
||||
.RB "[config file: " psShrinkLarger ] |
||||
.TP |
||||
.B \-nocenter |
||||
By default, PDF pages smaller than the paper (after any scaling) are |
||||
centered on the paper. This option causes them to be aligned to the |
||||
lower-left corner of the paper instead. |
||||
.RB "[config file: " psCenter ] |
||||
.TP |
||||
.B \-pagecrop |
||||
Treat the CropBox as the PDF page size. By default, the MediaBox is |
||||
used as the page size. |
||||
.TP |
||||
.B \-duplex |
||||
Set the Duplex pagedevice entry in the PostScript file. This tells |
||||
duplex-capable printers to enable duplexing. |
||||
.RB "[config file: " psDuplex ] |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.B \-q |
||||
Don't print any messages or errors. |
||||
.RB "[config file: " errQuiet ] |
||||
.TP |
||||
.BI \-cfg " config-file" |
||||
Read |
||||
.I config-file |
||||
in place of ~/.xpdfrc or the system-wide config file. |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdftops software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdffonts (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,202 +0,0 @@ |
||||
pdftops(1) pdftops(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdftops - Portable Document Format (PDF) to PostScript converter (ver- |
||||
sion 3.02) |
||||
|
||||
SYNOPSIS |
||||
pdftops [options] [PDF-file [PS-file]] |
||||
|
||||
DESCRIPTION |
||||
Pdftops converts Portable Document Format (PDF) files to PostScript so |
||||
they can be printed. |
||||
|
||||
Pdftops reads the PDF file, PDF-file, and writes a PostScript file, PS- |
||||
file. If PS-file is not specified, pdftops converts file.pdf to |
||||
file.ps (or file.eps with the -eps option). If PS-file is '-', the |
||||
PostScript is sent to stdout. |
||||
|
||||
CONFIGURATION FILE |
||||
Pdftops reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftops is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to print. |
||||
|
||||
-l number |
||||
Specifies the last page to print. |
||||
|
||||
-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files |
||||
will be significantly larger (if they contain images), but will |
||||
print on Level 1 printers. This also converts all images to |
||||
black and white. No more than one of the PostScript level |
||||
options (-level1, -level1sep, -level2, -level2sep, -level3, |
||||
-level3Sep) may be given. [config file: psLevel] |
||||
|
||||
-level1sep |
||||
Generate Level 1 separable PostScript. All colors are converted |
||||
to CMYK. Images are written with separate stream data for the |
||||
four components. [config file: psLevel] |
||||
|
||||
-level2 |
||||
Generate Level 2 PostScript. Level 2 supports color images and |
||||
image compression. This is the default setting. [config file: |
||||
psLevel] |
||||
|
||||
-level2sep |
||||
Generate Level 2 separable PostScript. All colors are converted |
||||
to CMYK. The PostScript separation convention operators are |
||||
used to handle custom (spot) colors. [config file: psLevel] |
||||
|
||||
-level3 |
||||
Generate Level 3 PostScript. This enables all Level 2 features |
||||
plus CID font embedding and masked image generation. [config |
||||
file: psLevel] |
||||
|
||||
-level3Sep |
||||
Generate Level 3 separable PostScript. The separation handling |
||||
is the same as for -level2Sep. [config file: psLevel] |
||||
|
||||
-eps Generate an Encapsulated PostScript (EPS) file. An EPS file |
||||
contains a single image, so if you use this option with a multi- |
||||
page PDF file, you must use -f and -l to specify a single page. |
||||
No more than one of the mode options (-eps, -form) may be given. |
||||
|
||||
-form Generate a PostScript form which can be imported by software |
||||
that understands forms. A form contains a single page, so if |
||||
you use this option with a multi-page PDF file, you must use -f |
||||
and -l to specify a single page. The -level1 option cannot be |
||||
used with -form. |
||||
|
||||
-opi Generate OPI comments for all images and forms which have OPI |
||||
information. (This option is only available if pdftops was com- |
||||
piled with OPI support.) [config file: psOPI] |
||||
|
||||
-noembt1 |
||||
By default, any Type 1 fonts which are embedded in the PDF file |
||||
are copied into the PostScript file. This option causes pdftops |
||||
to substitute base fonts instead. Embedded fonts make Post- |
||||
Script files larger, but may be necessary for readable output. |
||||
[config file: psEmbedType1Fonts] |
||||
|
||||
-noembtt |
||||
By default, any TrueType fonts which are embedded in the PDF |
||||
file are copied into the PostScript file. This option causes |
||||
pdftops to substitute base fonts instead. Embedded fonts make |
||||
PostScript files larger, but may be necessary for readable out- |
||||
put. Also, some PostScript interpreters do not have TrueType |
||||
rasterizers. [config file: psEmbedTrueTypeFonts] |
||||
|
||||
-noembcidps |
||||
By default, any CID PostScript fonts which are embedded in the |
||||
PDF file are copied into the PostScript file. This option dis- |
||||
ables that embedding. No attempt is made to substitute for non- |
||||
embedded CID PostScript fonts. [config file: psEmbedCID- |
||||
PostScriptFonts] |
||||
|
||||
-noembcidtt |
||||
By default, any CID TrueType fonts which are embedded in the PDF |
||||
file are copied into the PostScript file. This option disables |
||||
that embedding. No attempt is made to substitute for non-embed- |
||||
ded CID TrueType fonts. [config file: psEmbedCIDTrueTypeFonts] |
||||
|
||||
-preload |
||||
Convert PDF forms to PS procedures, and preload image data. |
||||
This uses more memory in the PostScript interpreter, but gener- |
||||
ates significantly smaller PS files in situations where, e.g., |
||||
the same image is drawn on every page of a long document. |
||||
|
||||
-paper size |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". |
||||
This can also be set to "match", which will set the paper size |
||||
to match the size specified in the PDF file. [config file: |
||||
psPaperSize] |
||||
|
||||
-paperw size |
||||
Set the paper width, in points. [config file: psPaperSize] |
||||
|
||||
-paperh size |
||||
Set the paper height, in points. [config file: psPaperSize] |
||||
|
||||
-nocrop |
||||
By default, output is cropped to the CropBox specified in the |
||||
PDF file. This option disables cropping. [config file: psCrop] |
||||
|
||||
-expand |
||||
Expand PDF pages smaller than the paper to fill the paper. By |
||||
default, these pages are not scaled. [config file: psExpandS- |
||||
maller] |
||||
|
||||
-noshrink |
||||
Don't scale PDF pages which are larger than the paper. By |
||||
default, pages larger than the paper are shrunk to fit. [config |
||||
file: psShrinkLarger] |
||||
|
||||
-nocenter |
||||
By default, PDF pages smaller than the paper (after any scaling) |
||||
are centered on the paper. This option causes them to be |
||||
aligned to the lower-left corner of the paper instead. [config |
||||
file: psCenter] |
||||
|
||||
-pagecrop |
||||
Treat the CropBox as the PDF page size. By default, the Media- |
||||
Box is used as the page size. |
||||
|
||||
-duplex |
||||
Set the Duplex pagedevice entry in the PostScript file. This |
||||
tells duplex-capable printers to enable duplexing. [config |
||||
file: psDuplex] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdftops software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 pdftops(1) |
@ -1,211 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdftops |
||||
|
||||
pdftops - Portable Document Format (PDF) to PostScript converter |
||||
|
||||
pdftops [options] [PDF-file [PS-file]] |
||||
|
||||
Pdftops converts Portable Document Format (PDF) files to PostScript so |
||||
they can be printed. |
||||
|
||||
Pdftops reads the PDF file, PDF-file, and writes a PostScript file, PS- |
||||
file. If PS-file is not specified, pdftops converts file.pdf to |
||||
file.ps (or file.eps with the -eps option). If PS-file is '-', the |
||||
PostScript is sent to stdout. |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdftops reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftops is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to print. |
||||
|
||||
-l number |
||||
Specifies the last page to print. |
||||
|
||||
-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files |
||||
will be significantly larger (if they contain images), but will |
||||
print on Level 1 printers. This also converts all images to |
||||
black and white. No more than one of the PostScript level |
||||
options (-level1, -level1sep, -level2, -level2sep, -level3, |
||||
-level3Sep) may be given. [config file: psLevel] |
||||
|
||||
-level1sep |
||||
Generate Level 1 separable PostScript. All colors are converted |
||||
to CMYK. Images are written with separate stream data for the |
||||
four components. [config file: psLevel] |
||||
|
||||
-level2 |
||||
Generate Level 2 PostScript. Level 2 supports color images and |
||||
image compression. This is the default setting. [config file: |
||||
psLevel] |
||||
|
||||
-level2sep |
||||
Generate Level 2 separable PostScript. All colors are converted |
||||
to CMYK. The PostScript separation convention operators are |
||||
used to handle custom (spot) colors. [config file: psLevel] |
||||
|
||||
-level3 |
||||
Generate Level 3 PostScript. This enables all Level 2 features |
||||
plus CID font embedding and masked image generation. [config |
||||
file: psLevel] |
||||
|
||||
-level3Sep |
||||
Generate Level 3 separable PostScript. The separation handling |
||||
is the same as for -level2Sep. [config file: psLevel] |
||||
|
||||
-eps Generate an Encapsulated PostScript (EPS) file. An EPS file |
||||
contains a single image, so if you use this option with a multi- |
||||
page PDF file, you must use -f and -l to specify a single page. |
||||
No more than one of the mode options (-eps, -form) may be given. |
||||
|
||||
-form Generate a PostScript form which can be imported by software |
||||
that understands forms. A form contains a single page, so if |
||||
you use this option with a multi-page PDF file, you must use -f |
||||
and -l to specify a single page. The -level1 option cannot be |
||||
used with -form. |
||||
|
||||
-opi Generate OPI comments for all images and forms which have OPI |
||||
information. (This option is only available if pdftops was com- |
||||
piled with OPI support.) [config file: psOPI] |
||||
|
||||
-noembt1 |
||||
By default, any Type 1 fonts which are embedded in the PDF file |
||||
are copied into the PostScript file. This option causes pdftops |
||||
to substitute base fonts instead. Embedded fonts make Post- |
||||
Script files larger, but may be necessary for readable output. |
||||
[config file: psEmbedType1Fonts] |
||||
|
||||
-noembtt |
||||
By default, any TrueType fonts which are embedded in the PDF |
||||
file are copied into the PostScript file. This option causes |
||||
pdftops to substitute base fonts instead. Embedded fonts make |
||||
PostScript files larger, but may be necessary for readable out- |
||||
put. Also, some PostScript interpreters do not have TrueType |
||||
rasterizers. [config file: psEmbedTrueTypeFonts] |
||||
|
||||
-noembcidps |
||||
By default, any CID PostScript fonts which are embedded in the |
||||
PDF file are copied into the PostScript file. This option dis- |
||||
ables that embedding. No attempt is made to substitute for non- |
||||
embedded CID PostScript fonts. [config file: psEmbedCID- |
||||
PostScriptFonts] |
||||
|
||||
-noembcidtt |
||||
By default, any CID TrueType fonts which are embedded in the PDF |
||||
file are copied into the PostScript file. This option disables |
||||
that embedding. No attempt is made to substitute for non-embed- |
||||
ded CID TrueType fonts. [config file: psEmbedCIDTrueTypeFonts] |
||||
|
||||
-preload |
||||
Convert PDF forms to PS procedures, and preload image data. |
||||
This uses more memory in the PostScript interpreter, but gener- |
||||
ates significantly smaller PS files in situations where, e.g., |
||||
the same image is drawn on every page of a long document. |
||||
|
||||
-paper size |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". |
||||
This can also be set to "match", which will set the paper size |
||||
to match the size specified in the PDF file. [config file: |
||||
psPaperSize] |
||||
|
||||
-paperw size |
||||
Set the paper width, in points. [config file: psPaperSize] |
||||
|
||||
-paperh size |
||||
Set the paper height, in points. [config file: psPaperSize] |
||||
|
||||
-nocrop |
||||
By default, output is cropped to the CropBox specified in the |
||||
PDF file. This option disables cropping. [config file: psCrop] |
||||
|
||||
-expand |
||||
Expand PDF pages smaller than the paper to fill the paper. By |
||||
default, these pages are not scaled. [config file: psExpandS- |
||||
maller] |
||||
|
||||
-noshrink |
||||
Don't scale PDF pages which are larger than the paper. By |
||||
default, pages larger than the paper are shrunk to fit. [config |
||||
file: psShrinkLarger] |
||||
|
||||
-nocenter |
||||
By default, PDF pages smaller than the paper (after any scaling) |
||||
are centered on the paper. This option causes them to be |
||||
aligned to the lower-left corner of the paper instead. [config |
||||
file: psCenter] |
||||
|
||||
-pagecrop |
||||
Treat the CropBox as the PDF page size. By default, the Media- |
||||
Box is used as the page size. |
||||
|
||||
-duplex |
||||
Set the Duplex pagedevice entry in the PostScript file. This |
||||
tells duplex-capable printers to enable duplexing. [config |
||||
file: psDuplex] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdftops software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,141 +0,0 @@ |
||||
.\" Copyright 1997-2007 Glyph & Cog, LLC |
||||
.TH pdftotext 1 "27 Febuary 2007" |
||||
.SH NAME |
||||
pdftotext \- Portable Document Format (PDF) to text converter |
||||
(version 3.02) |
||||
.SH SYNOPSIS |
||||
.B pdftotext |
||||
[options] |
||||
.RI [ PDF-file |
||||
.RI [ text-file ]] |
||||
.SH DESCRIPTION |
||||
.B Pdftotext |
||||
converts Portable Document Format (PDF) files to plain text. |
||||
.PP |
||||
Pdftotext reads the PDF file, |
||||
.IR PDF-file , |
||||
and writes a text file, |
||||
.IR text-file . |
||||
If |
||||
.I text-file |
||||
is not specified, pdftotext converts |
||||
.I file.pdf |
||||
to |
||||
.IR file.txt . |
||||
If |
||||
.I text-file |
||||
is \'-', the text is sent to stdout. |
||||
.SH CONFIGURATION FILE |
||||
Pdftotext reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't |
||||
exist, it looks for a system-wide config file, typically |
||||
/usr/local/etc/xpdfrc (but this location can be changed when pdftotext |
||||
is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands. These are listed in square brackets with the description of |
||||
the corresponding command line option. |
||||
.TP |
||||
.BI \-f " number" |
||||
Specifies the first page to convert. |
||||
.TP |
||||
.BI \-l " number" |
||||
Specifies the last page to convert. |
||||
.TP |
||||
.B \-layout |
||||
Maintain (as best as possible) the original physical layout of the |
||||
text. The default is to \'undo' physical layout (columns, |
||||
hyphenation, etc.) and output the text in reading order. |
||||
.TP |
||||
.BI \-fixed " number" |
||||
Assume fixed-pitch (or tabular) text, with the specified character |
||||
width (in points). This forces physical layout mode. |
||||
.TP |
||||
.B \-raw |
||||
Keep the text in content stream order. This is a hack which often |
||||
"undoes" column formatting, etc. Use of raw mode is no longer |
||||
recommended. |
||||
.TP |
||||
.B \-htmlmeta |
||||
Generate a simple HTML file, including the meta information. This |
||||
simply wraps the text in <pre> and </pre> and prepends the meta |
||||
headers. |
||||
.TP |
||||
.BI \-enc " encoding-name" |
||||
Sets the encoding to use for text output. The |
||||
.I encoding\-name |
||||
must be defined with the unicodeMap command (see |
||||
.BR xpdfrc (5)). |
||||
The encoding name is case-sensitive. This defaults to "Latin1" (which |
||||
is a built-in encoding). |
||||
.RB "[config file: " textEncoding ] |
||||
.TP |
||||
.BI \-eol " unix | dos | mac" |
||||
Sets the end-of-line convention to use for text output. |
||||
.RB "[config file: " textEOL ] |
||||
.TP |
||||
.B \-nopgbrk |
||||
Don't insert page breaks (form feed characters) between pages. |
||||
.RB "[config file: " textPageBreaks ] |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.B \-q |
||||
Don't print any messages or errors. |
||||
.RB "[config file: " errQuiet ] |
||||
.TP |
||||
.BI \-cfg " config-file" |
||||
Read |
||||
.I config-file |
||||
in place of ~/.xpdfrc or the system-wide config file. |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.SH BUGS |
||||
Some PDF files contain fonts whose encodings have been mangled beyond |
||||
recognition. There is no way (short of OCR) to extract text from |
||||
these files. |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The pdftotext software and documentation are copyright 1996-2007 Glyph |
||||
& Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdffonts (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,115 +0,0 @@ |
||||
pdftotext(1) pdftotext(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
pdftotext - Portable Document Format (PDF) to text converter (version |
||||
3.02) |
||||
|
||||
SYNOPSIS |
||||
pdftotext [options] [PDF-file [text-file]] |
||||
|
||||
DESCRIPTION |
||||
Pdftotext converts Portable Document Format (PDF) files to plain text. |
||||
|
||||
Pdftotext reads the PDF file, PDF-file, and writes a text file, text- |
||||
file. If text-file is not specified, pdftotext converts file.pdf to |
||||
file.txt. If text-file is '-', the text is sent to stdout. |
||||
|
||||
CONFIGURATION FILE |
||||
Pdftotext reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't exist, |
||||
it looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftotext is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to convert. |
||||
|
||||
-l number |
||||
Specifies the last page to convert. |
||||
|
||||
-layout |
||||
Maintain (as best as possible) the original physical layout of |
||||
the text. The default is to 'undo' physical layout (columns, |
||||
hyphenation, etc.) and output the text in reading order. |
||||
|
||||
-fixed number |
||||
Assume fixed-pitch (or tabular) text, with the specified charac- |
||||
ter width (in points). This forces physical layout mode. |
||||
|
||||
-raw Keep the text in content stream order. This is a hack which |
||||
often "undoes" column formatting, etc. Use of raw mode is no |
||||
longer recommended. |
||||
|
||||
-htmlmeta |
||||
Generate a simple HTML file, including the meta information. |
||||
This simply wraps the text in <pre> and </pre> and prepends the |
||||
meta headers. |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
The encoding name is case-sensitive. This defaults to "Latin1" |
||||
(which is a built-in encoding). [config file: textEncoding] |
||||
|
||||
-eol unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. [config |
||||
file: textEOL] |
||||
|
||||
-nopgbrk |
||||
Don't insert page breaks (form feed characters) between pages. |
||||
[config file: textPageBreaks] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
BUGS |
||||
Some PDF files contain fonts whose encodings have been mangled beyond |
||||
recognition. There is no way (short of OCR) to extract text from these |
||||
files. |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The pdftotext software and documentation are copyright 1996-2007 Glyph |
||||
& Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 Febuary 2007 pdftotext(1) |
@ -1,127 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 pdftotext |
||||
|
||||
pdftotext - Portable Document Format (PDF) to text converter |
||||
|
||||
pdftotext [options] [PDF-file [text-file]] |
||||
|
||||
Pdftotext converts Portable Document Format (PDF) files to plain text. |
||||
|
||||
Pdftotext reads the PDF file, PDF-file, and writes a text file, text- |
||||
file. If text-file is not specified, pdftotext converts file.pdf to |
||||
file.txt. If text-file is '-', the text is sent to stdout. |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Pdftotext reads a configuration file at startup. It first tries to |
||||
find the user's private config file, ~/.xpdfrc. If that doesn't exist, |
||||
it looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when pdftotext is built). See the |
||||
xpdfrc(5) man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands. These are listed in square brackets with the description of the |
||||
corresponding command line option. |
||||
|
||||
-f number |
||||
Specifies the first page to convert. |
||||
|
||||
-l number |
||||
Specifies the last page to convert. |
||||
|
||||
-layout |
||||
Maintain (as best as possible) the original physical layout of |
||||
the text. The default is to 'undo' physical layout (columns, |
||||
hyphenation, etc.) and output the text in reading order. |
||||
|
||||
-fixed number |
||||
Assume fixed-pitch (or tabular) text, with the specified charac- |
||||
ter width (in points). This forces physical layout mode. |
||||
|
||||
-raw Keep the text in content stream order. This is a hack which |
||||
often "undoes" column formatting, etc. Use of raw mode is no |
||||
longer recommended. |
||||
|
||||
-htmlmeta |
||||
Generate a simple HTML file, including the meta information. |
||||
This simply wraps the text in <pre> and </pre> and prepends the |
||||
meta headers. |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
The encoding name is case-sensitive. This defaults to "Latin1" |
||||
(which is a built-in encoding). [config file: textEncoding] |
||||
|
||||
-eol unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. [config |
||||
file: textEOL] |
||||
|
||||
-nopgbrk |
||||
Don't insert page breaks (form feed characters) between pages. |
||||
[config file: textPageBreaks] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
() |
||||
|
||||
2 BUGS |
||||
|
||||
Some PDF files contain fonts whose encodings have been mangled beyond |
||||
recognition. There is no way (short of OCR) to extract text from these |
||||
files. |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The pdftotext software and documentation are copyright 1996-2007 Glyph |
||||
& Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,92 +0,0 @@ |
||||
#======================================================================== |
||||
# |
||||
# Sample xpdfrc file |
||||
# |
||||
# The Xpdf tools look for a config file in two places: |
||||
# 1. ~/.xpdfrc |
||||
# 2. in a system-wide directory, typically /usr/local/etc/xpdfrc |
||||
# |
||||
# This sample config file demonstrates some of the more common |
||||
# configuration options. Everything here is commented out. You |
||||
# should edit things (especially the file/directory paths, since |
||||
# they'll likely be different on your system), and uncomment whichever |
||||
# options you want to use. For complete details on config file syntax |
||||
# and available options, please see the xpdfrc(5) man page. |
||||
# |
||||
# Also, the Xpdf language support packages each include a set of |
||||
# options to be added to the xpdfrc file. |
||||
# |
||||
# http://www.foolabs.com/xpdf/ |
||||
# |
||||
#======================================================================== |
||||
|
||||
#----- display fonts |
||||
|
||||
# These map the Base-14 fonts to the Type 1 fonts that ship with |
||||
# ghostscript. You'll almost certainly want to use something like |
||||
# this, but you'll need to adjust this to point to wherever |
||||
# ghostscript is installed on your system. (But if the fonts are |
||||
# installed in a "standard" location, xpdf will find them |
||||
# automatically.) |
||||
|
||||
#displayFontT1 Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb |
||||
#displayFontT1 Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb |
||||
#displayFontT1 Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb |
||||
#displayFontT1 Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb |
||||
#displayFontT1 Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb |
||||
#displayFontT1 Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb |
||||
#displayFontT1 Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb |
||||
#displayFontT1 Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb |
||||
#displayFontT1 Courier /usr/local/share/ghostscript/fonts/n022003l.pfb |
||||
#displayFontT1 Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb |
||||
#displayFontT1 Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb |
||||
#displayFontT1 Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb |
||||
#displayFontT1 Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb |
||||
#displayFontT1 ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb |
||||
|
||||
# If you need to display PDF files that refer to non-embedded fonts, |
||||
# you should add one or more fontDir options to point to the |
||||
# directories containing the font files. Xpdf will only look at .pfa, |
||||
# .pfb, and .ttf files in those directories (other files will simply |
||||
# be ignored). |
||||
|
||||
#fontDir /usr/local/fonts/bakoma |
||||
|
||||
#----- PostScript output control |
||||
|
||||
# Set the default PostScript file or command. |
||||
|
||||
#psFile "|lpr -Pmyprinter" |
||||
|
||||
# Set the default PostScript paper size -- this can be letter, legal, |
||||
# A4, or A3. You can also specify a paper size as width and height |
||||
# (in points). |
||||
|
||||
#psPaperSize letter |
||||
|
||||
#----- text output control |
||||
|
||||
# Choose a text encoding for copy-and-paste and for pdftotext output. |
||||
# The Latin1, ASCII7, and UTF-8 encodings are built into Xpdf. Other |
||||
# encodings are available in the language support packages. |
||||
|
||||
#textEncoding UTF-8 |
||||
|
||||
# Choose the end-of-line convention for multi-line copy-and-past and |
||||
# for pdftotext output. The available options are unix, mac, and dos. |
||||
|
||||
#textEOL unix |
||||
|
||||
#----- misc settings |
||||
|
||||
# Enable t1lib, FreeType, and anti-aliased text. |
||||
|
||||
#enableT1lib yes |
||||
#enableFreeType yes |
||||
#antialias yes |
||||
|
||||
# Set the command used to run a web browser when a URL hyperlink is |
||||
# clicked. |
||||
|
||||
#launchCommand viewer-script |
||||
#urlCommand "netscape -remote 'openURL(%s)'" |
@ -1,874 +0,0 @@ |
||||
.\" Copyright 1996-2007 Glyph & Cog, LLC |
||||
.TH xpdf 1 "27 February 2007" |
||||
.SH NAME |
||||
xpdf \- Portable Document Format (PDF) file viewer for X (version 3.02) |
||||
.SH SYNOPSIS |
||||
.B xpdf |
||||
[options] |
||||
.RI [ PDF-file |
||||
.RI [ page " | +" dest ]] |
||||
.SH DESCRIPTION |
||||
.B Xpdf |
||||
is a viewer for Portable Document Format (PDF) files. (These are also |
||||
sometimes also called \'Acrobat' files, from the name of Adobe's PDF |
||||
software.) Xpdf runs under the X Window System on UNIX, VMS, and |
||||
OS/2. |
||||
.PP |
||||
To run xpdf, simply type: |
||||
.PP |
||||
.RS |
||||
xpdf file.pdf |
||||
.RE |
||||
.PP |
||||
where |
||||
.I file.pdf |
||||
is your PDF file. The file name can be followed by a number |
||||
specifying the page which should be displayed first, e.g.: |
||||
.PP |
||||
.RS |
||||
xpdf file.pdf 18 |
||||
.RE |
||||
.PP |
||||
You can also give a named destination, prefixed with \'+' in place of |
||||
the page number. (This is only useful with PDF files that provide |
||||
named destination targets.) |
||||
.PP |
||||
You can also start xpdf without opening any files: |
||||
.PP |
||||
.RS |
||||
xpdf |
||||
.RE |
||||
.SH CONFIGURATION FILE |
||||
Xpdf reads a configuration file at startup. It first tries to find |
||||
the user's private config file, ~/.xpdfrc. If that doesn't exist, it |
||||
looks for a system-wide config file, typically /usr/local/etc/xpdfrc |
||||
(but this location can be changed when xpdf is built). See the |
||||
.BR xpdfrc (5) |
||||
man page for details. |
||||
.SH OPTIONS |
||||
Many of the following options can be set with configuration file |
||||
commands or X resources. These are listed in square brackets with the |
||||
description of the corresponding command line option. |
||||
.TP |
||||
.BI \-g " geometry" |
||||
Set the initial window geometry. |
||||
.RB ( \-geometry |
||||
is equivalent.) |
||||
.RB "[X resource: " xpdf.geometry ] |
||||
.TP |
||||
.BI \-title " title" |
||||
Set the window title. By default, the title will be "xpdf: foo.pdf". |
||||
.RB "[X resource: " xpdf.title ] |
||||
.TP |
||||
.B \-cmap |
||||
Install a private colormap. This is ignored on TrueColor visuals. |
||||
.RB "[X resource: " xpdf.installCmap ] |
||||
.TP |
||||
.BI \-rgb " number" |
||||
Set the size of largest RGB cube xpdf will try to allocate. The |
||||
default is 5 (for a 5x5x5 cube); set to a smaller number to conserve |
||||
color table entries. This is ignored with private colormaps and on |
||||
TrueColor visuals. |
||||
.RB "[X resource: " xpdf.rgbCubeSize ] |
||||
.TP |
||||
.B \-rv |
||||
Set reverse video mode. This reverses the colors of everything except |
||||
images. It may not always produce great results for PDF files which |
||||
do weird things with color. This also causes the paper color to |
||||
default to black. |
||||
.RB "[X resource: " xpdf.reverseVideo ] |
||||
.TP |
||||
.BI \-papercolor " color" |
||||
Set the "paper color", i.e., the background of the page display. This |
||||
will not work too well with PDF files that do things like filling in |
||||
white behind the text. |
||||
.RB "[X resource: " xpdf.paperColor ] |
||||
.TP |
||||
.BI \-mattecolor " color" |
||||
Set the matte color, i.e., the color used for background outside the |
||||
actual page area. (There is a separate setting, |
||||
xpdf.fullScreenMatteColor, for full-screen mode.) |
||||
.RB "[X resource: " xpdf.matteColor ] |
||||
.TP |
||||
.BI \-z " zoom" |
||||
Set the initial zoom factor. A number specifies a zoom percentage, |
||||
where 100 means 72 dpi.You may also specify \'page', to fit the page |
||||
to the window size, or \'width', to fit the page width to the window |
||||
width. |
||||
.RB "[config file: " initialZoom "; or X resource: " xpdf.initialZoom ] |
||||
.TP |
||||
.B \-cont |
||||
Start in continuous view mode, i.e., with one vertical scroll bar for |
||||
the whole document. |
||||
.RB "[config file: " continuousView ] |
||||
.TP |
||||
.BI \-t1lib " yes | no" |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This defaults to |
||||
"yes". |
||||
.RB "[config file: " enableT1lib ] |
||||
.TP |
||||
.BI \-freetype " yes | no" |
||||
Enable or disable FreeType (a TrueType / Type 1 font rasterizer). |
||||
This defaults to "yes". |
||||
.RB "[config file: " enableFreeType ] |
||||
.TP |
||||
.BI \-aa " yes | no" |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
.RB "[config file: " antialias ] |
||||
.TP |
||||
.BI \-aaVector " yes | no" |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
.RB "[config file: " vectorAntialias ] |
||||
.TP |
||||
.BI \-ps " PS-file" |
||||
Set the default file name for PostScript output (i.e., the name which |
||||
will appear in the print dialog). This can also be of the form |
||||
\'|command' to pipe the PostScript through a command. |
||||
.RB "[config file: " psFile ] |
||||
.TP |
||||
.BI \-paper " size" |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". This |
||||
can also be set to "match", which will set the paper size to match the |
||||
size specified in the PDF file. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.BI \-paperw " size" |
||||
Set the paper width, in points. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.BI \-paperh " size" |
||||
Set the paper height, in points. |
||||
.RB "[config file: " psPaperSize ] |
||||
.TP |
||||
.B \-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files will be |
||||
significantly larger (if they contain images), but will print on Level |
||||
1 printers. This also converts all images to black and white. |
||||
.RB "[config file: " psLevel ] |
||||
.TP |
||||
.BI \-enc " encoding-name" |
||||
Sets the encoding to use for text output. The |
||||
.I encoding\-name |
||||
must be defined with the unicodeMap command (see |
||||
.BR xpdfrc (5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). |
||||
.RB "[config file: " textEncoding ] |
||||
.TP |
||||
.BI \-eol " unix | dos | mac" |
||||
Sets the end-of-line convention to use for text output. |
||||
.RB "[config file: " textEOL ] |
||||
.TP |
||||
.BI \-opw " password" |
||||
Specify the owner password for the PDF file. Providing this will |
||||
bypass all security restrictions. |
||||
.TP |
||||
.BI \-upw " password" |
||||
Specify the user password for the PDF file. |
||||
.TP |
||||
.B \-fullscreen |
||||
Open xpdf in full-screen mode, useful for presentations. |
||||
.TP |
||||
.BI \-remote " name" |
||||
Start/contact xpdf remote server with specified name (see the |
||||
.B "REMOTE SERVER MODE" |
||||
section below). |
||||
.TP |
||||
.BI \-exec " command" |
||||
Execute a command (see the |
||||
.B COMMANDS |
||||
section below) in an xpdf remote server window (with -remote only). |
||||
.TP |
||||
.B \-reload |
||||
Reload xpdf remote server window (with -remote only). |
||||
.TP |
||||
.B \-raise |
||||
Raise xpdf remote server window (with -remote only). |
||||
.TP |
||||
.B \-quit |
||||
Kill xpdf remote server (with -remote only). |
||||
.TP |
||||
.B \-cmd |
||||
Print commands as they're executed (useful for debugging). |
||||
.RB "[config file: " printCommands ] |
||||
.TP |
||||
.B \-q |
||||
Don't print any messages or errors. |
||||
.RB "[config file: " errQuiet ] |
||||
.TP |
||||
.BI \-cfg " config-file" |
||||
Read |
||||
.I config-file |
||||
in place of ~/.xpdfrc or the system-wide config file. |
||||
.TP |
||||
.B \-v |
||||
Print copyright and version information. |
||||
.TP |
||||
.B \-h |
||||
Print usage information. |
||||
.RB ( \-help |
||||
and |
||||
.B \-\-help |
||||
are equivalent.) |
||||
.PP |
||||
Several other standard X options and resources will work as expected: |
||||
.TP |
||||
.BI \-display " display" |
||||
.RB "[X resource: " xpdf.display ] |
||||
.TP |
||||
.BI \-fg " color" |
||||
.RB ( \-foreground |
||||
is equivalent.) |
||||
.RB "[X resource: " xpdf*Foreground ] |
||||
.TP |
||||
.BI \-bg " color" |
||||
.RB ( \-background |
||||
is equivalent.) |
||||
.RB "[X resource: " xpdf*Background ] |
||||
.TP |
||||
.BI \-font " font" |
||||
.RB ( \-fn |
||||
is equivalent.) |
||||
.RB "[X resource: " xpdf*fontList ] |
||||
.PP |
||||
The color and font options only affect the user interface elements, |
||||
not the PDF display (the \'paper'). |
||||
.PP |
||||
The following X resources do not have command line option equivalents: |
||||
.TP |
||||
.B xpdf.toolTipEnable |
||||
Enables (if set to true) or disables (if set to false) the tool-tips |
||||
on the toolbar buttons. |
||||
.TP |
||||
.B xpdf.fullScreenMatteColor |
||||
Sets the matte color to be used in full-screen mode. The default |
||||
setting is "black". |
||||
.SH CONTROLS |
||||
.SS On-screen controls, at the bottom of the xpdf window |
||||
.TP |
||||
.B "left/right arrow buttons" |
||||
Move to the previous/next page. |
||||
.TP |
||||
.B "double left/right arrow buttons" |
||||
Move backward or forward by ten pages. |
||||
.TP |
||||
.B "dashed left/right arrow buttons" |
||||
Move backward or forward along the history path. |
||||
.TP |
||||
.B "\'Page' entry box" |
||||
Move to a specific page number. Click in the box to activate it, type |
||||
the page number, then hit return. |
||||
.TP |
||||
.B "zoom popup menu" |
||||
Change the zoom factor (see the description of the -z option above). |
||||
.TP |
||||
.B "binoculars button" |
||||
Find a text string. |
||||
.TP |
||||
.B "print button" |
||||
Bring up a dialog for generating a PostScript file. The dialog has |
||||
options to set the pages to be printed and the PostScript file name. |
||||
The file name can be \'-' for stdout or \'|command' to pipe the |
||||
PostScript through a command, e.g., \'|lpr'. |
||||
.TP |
||||
.B "\'?' button" |
||||
Bring up the \'about xpdf' window. |
||||
.TP |
||||
.B "link info" |
||||
The space between the \'?' and \'Quit' buttons is used to show the URL |
||||
or external file name when the mouse is over a link. |
||||
.TP |
||||
.B "\'Quit' button" |
||||
Quit xpdf. |
||||
.PP |
||||
.SS Menu |
||||
Pressing the right mouse button will post a popup menu with the |
||||
following commands: |
||||
.TP |
||||
.B "Open..." |
||||
Open a new PDF file via a file requester. |
||||
.TP |
||||
.B "Open in new window..." |
||||
Create a new window and open a new PDF file via a file requester. |
||||
.TP |
||||
.B "Reload" |
||||
Reload the current PDF file. Note that Xpdf will reload the file |
||||
automatically (on a page change or redraw) if it has changed since it |
||||
was last loaded. |
||||
.TP |
||||
.B "Save as..." |
||||
Save the current file via a file requester. |
||||
.TP |
||||
.B "Continuous view" |
||||
Toggles between single page and continuous view modes. |
||||
.TP |
||||
.B "Rotate counterclockwise" |
||||
Rotate the page 90 degrees counterclockwise. |
||||
.TP |
||||
.B "Rotate clockwise" |
||||
Rotate the page 90 degrees clockwise. The two rotate commands are |
||||
intended primarily for PDF files where the rotation isn't correctly |
||||
specified in the file. |
||||
.TP |
||||
.B "Zoom to selection" |
||||
Zoom in to the currently selected rectangle. |
||||
.TP |
||||
.B "Close" |
||||
Close the current window. If this is the only open window, the |
||||
document is closed, but the window is left open (i.e., this menu |
||||
command won't quit xpdf). |
||||
.TP |
||||
.B "Quit" |
||||
Quit xpdf. |
||||
.PP |
||||
.SS Outline |
||||
If the PDF contains an outline (a.k.a., bookmarks), there will be an |
||||
outline pane on the left side of the window. The width of the outline |
||||
pane is adjustable with a vertical split bar via the knob near its |
||||
bottom end. |
||||
.PP |
||||
.SS Text selection |
||||
Dragging the mouse with the left button held down will highlight an |
||||
arbitrary rectangle. Any text inside this rectangle will be copied to |
||||
the X selection buffer. |
||||
.PP |
||||
.SS Links |
||||
Clicking on a hyperlink will jump to the link's destination. A link |
||||
to another PDF document will make xpdf load that document. A |
||||
\'launch' link to an executable program will display a dialog, and if |
||||
you click \'ok', execute the program. URL links call an external |
||||
command (see the |
||||
.B WEB BROWSERS |
||||
section below). |
||||
.PP |
||||
.SS Panning |
||||
Dragging the mouse with the middle button held down pans the window. |
||||
.PP |
||||
.SS Key bindings |
||||
.TP |
||||
.B o |
||||
Open a new PDF file via a file requester. |
||||
.TP |
||||
.B r |
||||
Reload the current PDF file. Note that Xpdf will reload the file |
||||
automatically (on a page change or redraw) if it has changed since it |
||||
was last loaded. |
||||
.TP |
||||
.B control-L |
||||
Redraw the current page. |
||||
.TP |
||||
.B control-W |
||||
Close the current window. |
||||
.TP |
||||
.B f or control-F |
||||
Find a text string. |
||||
.TP |
||||
.B control-G |
||||
Find next occurrence. |
||||
.TP |
||||
.B control-P |
||||
Print. |
||||
.TP |
||||
.B n |
||||
Move to the next page. Scrolls to the top of the page, unless scroll |
||||
lock is turned on. |
||||
.TP |
||||
.B p |
||||
Move to the previous page. Scrolls to the top of the page, unless |
||||
scroll lock is turned on. |
||||
.TP |
||||
.BR <Space> " or " <PageDown> " or " <Next> |
||||
Scroll down on the current page; if already at bottom, move to next |
||||
page. |
||||
.TP |
||||
.BR <Backspace> " or " <Delete> " or " <PageUp> " or " <Previous> |
||||
Scroll up on the current page; if already at top, move to previous |
||||
page. |
||||
.TP |
||||
.B v |
||||
Move forward along the history path. |
||||
.TP |
||||
.B b |
||||
Move backward along the history path. |
||||
.TP |
||||
.B <Home> |
||||
Scroll to top of current page. |
||||
.TP |
||||
.B <End> |
||||
Scroll to bottom of current page. |
||||
.TP |
||||
.B control-<Home> |
||||
Scroll to first page of document. |
||||
.TP |
||||
.B control-<End> |
||||
Scroll to last page of document. |
||||
.TP |
||||
.B arrows |
||||
Scroll the current page. |
||||
.TP |
||||
.B g |
||||
Activate the page number text field ("goto page"). |
||||
.TP |
||||
.B 0 |
||||
Set the zoom factor to 125%. |
||||
.TP |
||||
.B + |
||||
Zoom in (increment the zoom factor by 1). |
||||
.TP |
||||
.B - |
||||
Zoom out (decrement the zoom factor by 1). |
||||
.TP |
||||
.B z |
||||
Set the zoom factor to 'page' (fit page to window). |
||||
.TP |
||||
.B w |
||||
Set the zoom factor to 'width' (fit page width to window). |
||||
.TP |
||||
.B alt-F |
||||
Toggle full-screen mode. |
||||
.TP |
||||
.B q |
||||
Quit xpdf. |
||||
.SH "WEB BROWSERS" |
||||
If you want to run xpdf automatically from netscape or mosaic (and |
||||
probably other browsers) when you click on a link to a PDF file, you |
||||
need to edit (or create) the files |
||||
.I .mime.types |
||||
and |
||||
.I .mailcap |
||||
in your home directory. In |
||||
.I .mime.types |
||||
add the line: |
||||
.PP |
||||
.RS |
||||
application/pdf pdf |
||||
.RE |
||||
.PP |
||||
In |
||||
.I .mailcap |
||||
add the lines: |
||||
.PP |
||||
.RS |
||||
# Use xpdf to view PDF files. |
||||
.RE |
||||
.RS |
||||
application/pdf; xpdf -q %s |
||||
.RE |
||||
.PP |
||||
Make sure that xpdf is on your executable search path. |
||||
.PP |
||||
When you click on a URL link in a PDF file, xpdf will execute the |
||||
command specified by the urlCommand config file option, replacing an |
||||
occurrence of \'%s' with the URL. For example, to call netscape with |
||||
the URL, add this line to your config file: |
||||
.PP |
||||
.RS |
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
.RE |
||||
.SH COMMANDS |
||||
Xpdf's key and mouse bindings are user-configurable, using the bind and |
||||
unbind options in the config file (see |
||||
.BR xpdfrc (5)). |
||||
The bind command allows you to bind a key or mouse button to a |
||||
sequence of one or more commands. |
||||
.SS Available Commands |
||||
The following commands are supported: |
||||
.TP |
||||
.BI gotoPage( page ) |
||||
Go to the specified page. |
||||
.TP |
||||
.BI gotoPageNoScroll( page ) |
||||
Go to the specified page, with the current relative scroll position. |
||||
.TP |
||||
.BI gotoDest( dest ) |
||||
Go to a named destination. |
||||
.TP |
||||
.B gotoLastPage |
||||
Go to the last page in the PDF file. |
||||
.TP |
||||
.B gotoLastPageNoScroll |
||||
Go to the last page in the PDF file, with the current relative scroll |
||||
position. |
||||
.TP |
||||
.B nextPage |
||||
Go to the next page. |
||||
.TP |
||||
.B nextPageNoScroll |
||||
Go to the next page, with the current relative scroll position. |
||||
.TP |
||||
.B prevPage |
||||
Go to the previous page. |
||||
.TP |
||||
.B prevPageNoScroll |
||||
Go to the previous page, with the current relative scroll position. |
||||
.TP |
||||
.B pageUp |
||||
Scroll up by one screenful. |
||||
.TP |
||||
.B pageDown |
||||
Scroll down by one screenful. |
||||
.TP |
||||
.BI scrollLeft( n ) |
||||
Scroll left by |
||||
.I n |
||||
pixels. |
||||
.TP |
||||
.BI scrollRight( n ) |
||||
Scroll right by |
||||
.I n |
||||
pixels. |
||||
.TP |
||||
.BI scrollUp( n ) |
||||
Scroll up by |
||||
.I n |
||||
pixels. |
||||
.TP |
||||
.BI scrollDown( n ) |
||||
Scroll down by |
||||
.I n |
||||
pixels. |
||||
.TP |
||||
.BI scrollUpPrevPage( n ) |
||||
Scroll up by |
||||
.I n |
||||
pixels, moving to the previous page if appropriate. |
||||
.TP |
||||
.BI scrollDownPrevPage( n ) |
||||
Scroll down by |
||||
.I n |
||||
pixels, moving to the next page if appropriate. |
||||
.TP |
||||
.B scrollToTopEdge |
||||
Scroll to the top edge of the current page, with no horizontal |
||||
movement. |
||||
.TP |
||||
.B scrollToBottomEdge |
||||
Scroll to the bottom edge of the current page, with no horizontal |
||||
movement. |
||||
.TP |
||||
.B scrollToLeftEdge |
||||
Scroll to the left edge of the current page, with no vertical |
||||
movement. |
||||
.TP |
||||
.B scrollToRightEdge |
||||
Scroll to the right edge of the current page, with no vertical |
||||
movement. |
||||
.TP |
||||
.B scrollToTopLeft |
||||
Scroll to the top-left corner of the current page. |
||||
.TP |
||||
.B scrollToBottomRight |
||||
Scroll to the bottom-right corner of the current page. |
||||
.TP |
||||
.B goForward |
||||
Move forward along the history path. |
||||
.TP |
||||
.B goBackward |
||||
Move backward along the history path. |
||||
.TP |
||||
.BI zoomPercent( z ) |
||||
Set the zoom factor to |
||||
.IR z %. |
||||
.TP |
||||
.B zoomFitPage |
||||
Set the zoom factor to fit-page. |
||||
.TP |
||||
.B zoomFitWidth |
||||
Set the zoom factor to fit-width. |
||||
.TP |
||||
.B zoomIn |
||||
Zoom in - go to the next higher zoom factor. |
||||
.TP |
||||
.B zoomOut |
||||
Zoom out - go the next lower zoom factor. |
||||
.TP |
||||
.B rotateCW |
||||
Rotate the page 90 degrees clockwise. |
||||
.TP |
||||
.B rotateCCW |
||||
Rotate the page 90 degrees counterclockwise. |
||||
.TP |
||||
.BI setSelection( pg , ulx , uly , lrx , lry ) |
||||
Set the selection to the specified coordinates on the specified page. |
||||
.TP |
||||
.B continuousMode |
||||
Go to continuous view mode. |
||||
.TP |
||||
.B singlePageMode |
||||
Go to single-page view mode. |
||||
.TP |
||||
.B toggleContinuousMode |
||||
Toggle between continuous and single page view modes. |
||||
.TP |
||||
.B fullScreenMode |
||||
Go to full-screen mode. |
||||
.TP |
||||
.B windowMode |
||||
Go to window (non-full-screen) mode. |
||||
.TP |
||||
.B toggleFullScreenMode |
||||
Toggle between full-screen and window modes. |
||||
.TP |
||||
.B open |
||||
Open a PDF file in this window, using the open dialog. |
||||
.TP |
||||
.B openInNewWin |
||||
Open a PDF file in a new window, using the open dialog. |
||||
.TP |
||||
.BI openFile( file ) |
||||
Open a specified PDF file in this window. |
||||
.TP |
||||
.BI openFileInNewWin( file ) |
||||
Open a specified PDF file in a new window. |
||||
.TP |
||||
.BI openFileAtDest( file , dest ) |
||||
Open a specified PDF file in this window and go to a named |
||||
destination. |
||||
.TP |
||||
.BI openFileAtDestInNewWin( file , dest ) |
||||
Open a specified PDF file in a new window and go to a named |
||||
destination. |
||||
.TP |
||||
.B reload |
||||
Reload the current PDF file. |
||||
.TP |
||||
.B redraw |
||||
Redraw the window. |
||||
.TP |
||||
.B raise |
||||
Raise the window to the front. |
||||
.TP |
||||
.B closeWindow |
||||
Close the window. |
||||
.TP |
||||
.BI run( external-command-string ) |
||||
Run an external command. The following escapes are allowed in the |
||||
command string: |
||||
.nf |
||||
|
||||
%f => PDF file name (or an empty string if no |
||||
file is open) |
||||
%b => PDF file base name, i.e., file name minus |
||||
the extension (or an empty string if no |
||||
file is open) |
||||
%u => link URL (or an empty string if not over |
||||
a URL link) |
||||
%p => current page number (or an empty string if |
||||
no file is open) |
||||
%x => selection upper-left x coordinate |
||||
(or 0 if there is no selection) |
||||
%y => selection upper-left y coordinate |
||||
(or 0 if there is no selection) |
||||
%X => selection lower-right x coordinate |
||||
(or 0 if there is no selection) |
||||
%Y => selection lower-right y coordinate |
||||
(or 0 if there is no selection) |
||||
%% => % |
||||
|
||||
.fi |
||||
.TP |
||||
.B openOutline |
||||
Open the outline pane. |
||||
.TP |
||||
.B closeOutline |
||||
Close the outline pane. |
||||
.TP |
||||
.B toggleOutline |
||||
Toggle the outline pane between open and closed. |
||||
.TP |
||||
.BI scrollOutlineDown( n ) |
||||
Scroll the outline down by |
||||
.I n |
||||
increments. |
||||
.TP |
||||
.BI scrollOutlineUp( n ) |
||||
Scroll the outline up by |
||||
.I n |
||||
increments. |
||||
.TP |
||||
.B focusToDocWin |
||||
Set the keyboard focus to the main document window. |
||||
.TP |
||||
.B focusToPageNum |
||||
Set the keyboard focus to the page number text box. |
||||
.TP |
||||
.B find |
||||
Open the 'find' dialog. |
||||
.TP |
||||
.B findNext |
||||
Finds the next occurrence of the search string (no dialog). |
||||
.TP |
||||
.B print |
||||
Open the 'print' dialog. |
||||
.TP |
||||
.B about |
||||
Open the 'about' dialog. |
||||
.TP |
||||
.B quit |
||||
Quit from xpdf. |
||||
.PP |
||||
The following commands depend on the current mouse position: |
||||
.TP |
||||
.B startSelection |
||||
Start a selection, which will be extended as the mouse moves. |
||||
.TP |
||||
.B endSelection |
||||
End a selection. |
||||
.TP |
||||
.B startPan |
||||
Start a pan, which will scroll the document as the mouse moves |
||||
.TP |
||||
.B endPan |
||||
End a pan. |
||||
.TP |
||||
.B postPopupMenu |
||||
Display the popup menu. |
||||
.TP |
||||
.B followLink |
||||
Follow a hyperlink (does nothing if the mouse is not over a link). |
||||
.TP |
||||
.B followLinkInNewWin |
||||
Follow a hyperlink, opening PDF files in a new window (does nothing if |
||||
the mouse is not over a link). For links to non-PDF files, this |
||||
command is identical to followLink. |
||||
.TP |
||||
.B followLinkNoSel |
||||
Same as followLink, but does nothing if there is a non-empty selection. |
||||
(This is useful as a mouse button binding.) |
||||
.TP |
||||
.B followLinkInNewWinNoSel |
||||
Same as followLinkInNewWin, but does nothing if there is a non-empty |
||||
selection. (This is useful as a mouse button binding.) |
||||
.SS Default Bindings |
||||
The default mouse bindings are as follows: |
||||
.nf |
||||
|
||||
bind mousePress1 any startSelection |
||||
bind mouseRelease1 any endSelection followLinkNoSel |
||||
bind mousePress2 any startPan |
||||
bind mouseRelease2 any endPan |
||||
bind mousePress3 any postPopupMenu |
||||
bind mousePress4 any scrollUpPrevPage(16) |
||||
bind mousePress5 any scrollDownNextPage(16) |
||||
bind mousePress6 any scrollLeft(16) |
||||
bind mousePress7 any scrollRight(16) |
||||
|
||||
.fi |
||||
The default key bindings are as follows: |
||||
.nf |
||||
|
||||
bind ctrl-home any gotoPage(1) |
||||
bind home any scrollToTopLeft |
||||
bind ctrl-end any gotoLastPage |
||||
bind end any scrollToBottomRight |
||||
bind pgup any pageUp |
||||
bind backspace any pageUp |
||||
bind delete any pageUp |
||||
bind pgdn any pageDown |
||||
bind space any pageDown |
||||
bind left any scrollLeft(16) |
||||
bind right any scrollRight(16) |
||||
bind up any scrollUp(16) |
||||
bind down any scrollDown(16) |
||||
bind o any open |
||||
bind O any open |
||||
bind r any reload |
||||
bind R any reload |
||||
bind f any find |
||||
bind F any find |
||||
bind ctrl-f any find |
||||
bind ctrl-g any findNext |
||||
bind ctrl-p any print |
||||
bind n scrLockOff nextPage |
||||
bind N scrLockOff nextPage |
||||
bind n scrLockOn nextPageNoScroll |
||||
bind N scrLockOn nextPageNoScroll |
||||
bind p scrLockOff prevPage |
||||
bind P scrLockOff prevPage |
||||
bind p scrLockOn prevPageNoScroll |
||||
bind P scrLockOn prevPageNoScroll |
||||
bind v any goForward |
||||
bind b any goBackward |
||||
bind g any focusToPageNum |
||||
bind 0 any zoomPercent(125) |
||||
bind + any zoomIn |
||||
bind - any zoomOut |
||||
bind z any zoomFitPage |
||||
bind w any zoomFitWidth |
||||
bind alt-f any toggleFullScreenMode |
||||
bind ctrl-l any redraw |
||||
bind ctrl-w any closeWindow |
||||
bind ? any about |
||||
bind q any quit |
||||
bind Q any quit |
||||
|
||||
.fi |
||||
Previous versions of xpdf included a "viKeys" X resource. It is no |
||||
longer available, but the following bindings are equivalent: |
||||
.nf |
||||
|
||||
bind h any scrollLeft(16) |
||||
bind l any scrollRight(16) |
||||
bind k any scrollUp(16) |
||||
bind j any scrollDown(16) |
||||
|
||||
.fi |
||||
.SH "REMOTE SERVER MODE" |
||||
Xpdf can be started in remote server mode by specifying a server name |
||||
(in addition to the file name and page number). For example: |
||||
.PP |
||||
.RS |
||||
xpdf -remote myServer file.pdf |
||||
.RE |
||||
.PP |
||||
If there is currently no xpdf running in server mode with the name |
||||
\'myServer', a new xpdf window will be opened. If another command: |
||||
.PP |
||||
.RS |
||||
xpdf -remote myServer another.pdf 9 |
||||
.RE |
||||
.PP |
||||
is issued, a new copy of xpdf will not be started. Instead, the first |
||||
xpdf (the server) will load |
||||
.I another.pdf |
||||
and display page nine. If the file name is the same: |
||||
.PP |
||||
.RS |
||||
xpdf -remote myServer another.pdf 4 |
||||
.RE |
||||
.PP |
||||
the xpdf server will simply display the specified page. |
||||
.PP |
||||
The -raise option tells the server to raise its window; it can be |
||||
specified with or without a file name and page number. |
||||
.PP |
||||
The -quit option tells the server to close its window and exit. |
||||
.SH EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
.TP |
||||
0 |
||||
No error. |
||||
.TP |
||||
1 |
||||
Error opening a PDF file. |
||||
.TP |
||||
2 |
||||
Error opening an output file. |
||||
.TP |
||||
3 |
||||
Error related to PDF permissions. |
||||
.TP |
||||
99 |
||||
Other error. |
||||
.SH AUTHOR |
||||
The xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdffonts (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1), |
||||
.BR xpdfrc (5) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,765 +0,0 @@ |
||||
xpdf(1) xpdf(1) |
||||
|
||||
|
||||
|
||||
NAME |
||||
xpdf - Portable Document Format (PDF) file viewer for X (version 3.02) |
||||
|
||||
SYNOPSIS |
||||
xpdf [options] [PDF-file [page | +dest]] |
||||
|
||||
DESCRIPTION |
||||
Xpdf is a viewer for Portable Document Format (PDF) files. (These are |
||||
also sometimes also called 'Acrobat' files, from the name of Adobe's |
||||
PDF software.) Xpdf runs under the X Window System on UNIX, VMS, and |
||||
OS/2. |
||||
|
||||
To run xpdf, simply type: |
||||
|
||||
xpdf file.pdf |
||||
|
||||
where file.pdf is your PDF file. The file name can be followed by a |
||||
number specifying the page which should be displayed first, e.g.: |
||||
|
||||
xpdf file.pdf 18 |
||||
|
||||
You can also give a named destination, prefixed with '+' in place of |
||||
the page number. (This is only useful with PDF files that provide |
||||
named destination targets.) |
||||
|
||||
You can also start xpdf without opening any files: |
||||
|
||||
xpdf |
||||
|
||||
CONFIGURATION FILE |
||||
Xpdf reads a configuration file at startup. It first tries to find the |
||||
user's private config file, ~/.xpdfrc. If that doesn't exist, it looks |
||||
for a system-wide config file, typically /usr/local/etc/xpdfrc (but |
||||
this location can be changed when xpdf is built). See the xpdfrc(5) |
||||
man page for details. |
||||
|
||||
OPTIONS |
||||
Many of the following options can be set with configuration file com- |
||||
mands or X resources. These are listed in square brackets with the |
||||
description of the corresponding command line option. |
||||
|
||||
-g geometry |
||||
Set the initial window geometry. (-geometry is equivalent.) [X |
||||
resource: xpdf.geometry] |
||||
|
||||
-title title |
||||
Set the window title. By default, the title will be "xpdf: |
||||
foo.pdf". [X resource: xpdf.title] |
||||
|
||||
-cmap Install a private colormap. This is ignored on TrueColor visu- |
||||
als. [X resource: xpdf.installCmap] |
||||
|
||||
-rgb number |
||||
Set the size of largest RGB cube xpdf will try to allocate. The |
||||
default is 5 (for a 5x5x5 cube); set to a smaller number to con- |
||||
serve color table entries. This is ignored with private col- |
||||
ormaps and on TrueColor visuals. [X resource: xpdf.rgbCubeSize] |
||||
|
||||
-rv Set reverse video mode. This reverses the colors of everything |
||||
except images. It may not always produce great results for PDF |
||||
files which do weird things with color. This also causes the |
||||
paper color to default to black. [X resource: xpdf.reverseV- |
||||
ideo] |
||||
|
||||
-papercolor color |
||||
Set the "paper color", i.e., the background of the page display. |
||||
This will not work too well with PDF files that do things like |
||||
filling in white behind the text. [X resource: xpdf.paperColor] |
||||
|
||||
-mattecolor color |
||||
Set the matte color, i.e., the color used for background outside |
||||
the actual page area. (There is a separate setting, |
||||
xpdf.fullScreenMatteColor, for full-screen mode.) [X resource: |
||||
xpdf.matteColor] |
||||
|
||||
-z zoom |
||||
Set the initial zoom factor. A number specifies a zoom percent- |
||||
age, where 100 means 72 dpi.You may also specify 'page', to fit |
||||
the page to the window size, or 'width', to fit the page width |
||||
to the window width. [config file: initialZoom; or X resource: |
||||
xpdf.initialZoom] |
||||
|
||||
-cont Start in continuous view mode, i.e., with one vertical scroll |
||||
bar for the whole document. [config file: continuousView] |
||||
|
||||
-t1lib yes | no |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This |
||||
defaults to "yes". [config file: enableT1lib] |
||||
|
||||
-freetype yes | no |
||||
Enable or disable FreeType (a TrueType / Type 1 font raster- |
||||
izer). This defaults to "yes". [config file: enableFreeType] |
||||
|
||||
-aa yes | no |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
[config file: antialias] |
||||
|
||||
-aaVector yes | no |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
[config file: vectorAntialias] |
||||
|
||||
-ps PS-file |
||||
Set the default file name for PostScript output (i.e., the name |
||||
which will appear in the print dialog). This can also be of the |
||||
form '|command' to pipe the PostScript through a command. [con- |
||||
fig file: psFile] |
||||
|
||||
-paper size |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". |
||||
This can also be set to "match", which will set the paper size |
||||
to match the size specified in the PDF file. [config file: |
||||
psPaperSize] |
||||
|
||||
-paperw size |
||||
Set the paper width, in points. [config file: psPaperSize] |
||||
|
||||
-paperh size |
||||
Set the paper height, in points. [config file: psPaperSize] |
||||
|
||||
-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files |
||||
will be significantly larger (if they contain images), but will |
||||
print on Level 1 printers. This also converts all images to |
||||
black and white. [config file: psLevel] |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). [con- |
||||
fig file: textEncoding] |
||||
|
||||
-eol unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. [config |
||||
file: textEOL] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-fullscreen |
||||
Open xpdf in full-screen mode, useful for presentations. |
||||
|
||||
-remote name |
||||
Start/contact xpdf remote server with specified name (see the |
||||
REMOTE SERVER MODE section below). |
||||
|
||||
-exec command |
||||
Execute a command (see the COMMANDS section below) in an xpdf |
||||
remote server window (with -remote only). |
||||
|
||||
-reload |
||||
Reload xpdf remote server window (with -remote only). |
||||
|
||||
-raise Raise xpdf remote server window (with -remote only). |
||||
|
||||
-quit Kill xpdf remote server (with -remote only). |
||||
|
||||
-cmd Print commands as they're executed (useful for debugging). |
||||
[config file: printCommands] |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
Several other standard X options and resources will work as expected: |
||||
|
||||
-display display |
||||
[X resource: xpdf.display] |
||||
|
||||
-fg color |
||||
(-foreground is equivalent.) [X resource: xpdf*Foreground] |
||||
|
||||
-bg color |
||||
(-background is equivalent.) [X resource: xpdf*Background] |
||||
|
||||
-font font |
||||
(-fn is equivalent.) [X resource: xpdf*fontList] |
||||
|
||||
The color and font options only affect the user interface elements, not |
||||
the PDF display (the 'paper'). |
||||
|
||||
The following X resources do not have command line option equivalents: |
||||
|
||||
xpdf.toolTipEnable |
||||
Enables (if set to true) or disables (if set to false) the tool- |
||||
tips on the toolbar buttons. |
||||
|
||||
xpdf.fullScreenMatteColor |
||||
Sets the matte color to be used in full-screen mode. The |
||||
default setting is "black". |
||||
|
||||
CONTROLS |
||||
On-screen controls, at the bottom of the xpdf window |
||||
left/right arrow buttons |
||||
Move to the previous/next page. |
||||
|
||||
double left/right arrow buttons |
||||
Move backward or forward by ten pages. |
||||
|
||||
dashed left/right arrow buttons |
||||
Move backward or forward along the history path. |
||||
|
||||
'Page' entry box |
||||
Move to a specific page number. Click in the box to activate |
||||
it, type the page number, then hit return. |
||||
|
||||
zoom popup menu |
||||
Change the zoom factor (see the description of the -z option |
||||
above). |
||||
|
||||
binoculars button |
||||
Find a text string. |
||||
|
||||
print button |
||||
Bring up a dialog for generating a PostScript file. The dialog |
||||
has options to set the pages to be printed and the PostScript |
||||
file name. The file name can be '-' for stdout or '|command' to |
||||
pipe the PostScript through a command, e.g., '|lpr'. |
||||
|
||||
'?' button |
||||
Bring up the 'about xpdf' window. |
||||
|
||||
link info |
||||
The space between the '?' and 'Quit' buttons is used to show the |
||||
URL or external file name when the mouse is over a link. |
||||
|
||||
'Quit' button |
||||
Quit xpdf. |
||||
|
||||
|
||||
Menu |
||||
Pressing the right mouse button will post a popup menu with the follow- |
||||
ing commands: |
||||
|
||||
Open... |
||||
Open a new PDF file via a file requester. |
||||
|
||||
Open in new window... |
||||
Create a new window and open a new PDF file via a file |
||||
requester. |
||||
|
||||
Reload Reload the current PDF file. Note that Xpdf will reload the |
||||
file automatically (on a page change or redraw) if it has |
||||
changed since it was last loaded. |
||||
|
||||
Save as... |
||||
Save the current file via a file requester. |
||||
|
||||
Continuous view |
||||
Toggles between single page and continuous view modes. |
||||
|
||||
Rotate counterclockwise |
||||
Rotate the page 90 degrees counterclockwise. |
||||
|
||||
Rotate clockwise |
||||
Rotate the page 90 degrees clockwise. The two rotate commands |
||||
are intended primarily for PDF files where the rotation isn't |
||||
correctly specified in the file. |
||||
|
||||
Zoom to selection |
||||
Zoom in to the currently selected rectangle. |
||||
|
||||
Close Close the current window. If this is the only open window, the |
||||
document is closed, but the window is left open (i.e., this menu |
||||
command won't quit xpdf). |
||||
|
||||
Quit Quit xpdf. |
||||
|
||||
|
||||
Outline |
||||
If the PDF contains an outline (a.k.a., bookmarks), there will be an |
||||
outline pane on the left side of the window. The width of the outline |
||||
pane is adjustable with a vertical split bar via the knob near its bot- |
||||
tom end. |
||||
|
||||
|
||||
Text selection |
||||
Dragging the mouse with the left button held down will highlight an |
||||
arbitrary rectangle. Any text inside this rectangle will be copied to |
||||
the X selection buffer. |
||||
|
||||
|
||||
Links |
||||
Clicking on a hyperlink will jump to the link's destination. A link to |
||||
another PDF document will make xpdf load that document. A 'launch' |
||||
link to an executable program will display a dialog, and if you click |
||||
'ok', execute the program. URL links call an external command (see the |
||||
WEB BROWSERS section below). |
||||
|
||||
|
||||
Panning |
||||
Dragging the mouse with the middle button held down pans the window. |
||||
|
||||
|
||||
Key bindings |
||||
o Open a new PDF file via a file requester. |
||||
|
||||
r Reload the current PDF file. Note that Xpdf will reload the |
||||
file automatically (on a page change or redraw) if it has |
||||
changed since it was last loaded. |
||||
|
||||
control-L |
||||
Redraw the current page. |
||||
|
||||
control-W |
||||
Close the current window. |
||||
|
||||
f or control-F |
||||
Find a text string. |
||||
|
||||
control-G |
||||
Find next occurrence. |
||||
|
||||
control-P |
||||
Print. |
||||
|
||||
n Move to the next page. Scrolls to the top of the page, unless |
||||
scroll lock is turned on. |
||||
|
||||
p Move to the previous page. Scrolls to the top of the page, |
||||
unless scroll lock is turned on. |
||||
|
||||
<Space> or <PageDown> or <Next> |
||||
Scroll down on the current page; if already at bottom, move to |
||||
next page. |
||||
|
||||
<Backspace> or <Delete> or <PageUp> or <Previous> |
||||
Scroll up on the current page; if already at top, move to previ- |
||||
ous page. |
||||
|
||||
v Move forward along the history path. |
||||
|
||||
b Move backward along the history path. |
||||
|
||||
<Home> Scroll to top of current page. |
||||
|
||||
<End> Scroll to bottom of current page. |
||||
|
||||
control-<Home> |
||||
Scroll to first page of document. |
||||
|
||||
control-<End> |
||||
Scroll to last page of document. |
||||
|
||||
arrows Scroll the current page. |
||||
|
||||
g Activate the page number text field ("goto page"). |
||||
|
||||
0 Set the zoom factor to 125%. |
||||
|
||||
+ Zoom in (increment the zoom factor by 1). |
||||
|
||||
- Zoom out (decrement the zoom factor by 1). |
||||
|
||||
z Set the zoom factor to 'page' (fit page to window). |
||||
|
||||
w Set the zoom factor to 'width' (fit page width to window). |
||||
|
||||
alt-F Toggle full-screen mode. |
||||
|
||||
q Quit xpdf. |
||||
|
||||
WEB BROWSERS |
||||
If you want to run xpdf automatically from netscape or mosaic (and |
||||
probably other browsers) when you click on a link to a PDF file, you |
||||
need to edit (or create) the files .mime.types and .mailcap in your |
||||
home directory. In .mime.types add the line: |
||||
|
||||
application/pdf pdf |
||||
|
||||
In .mailcap add the lines: |
||||
|
||||
# Use xpdf to view PDF files. |
||||
application/pdf; xpdf -q %s |
||||
|
||||
Make sure that xpdf is on your executable search path. |
||||
|
||||
When you click on a URL link in a PDF file, xpdf will execute the com- |
||||
mand specified by the urlCommand config file option, replacing an |
||||
occurrence of '%s' with the URL. For example, to call netscape with |
||||
the URL, add this line to your config file: |
||||
|
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
|
||||
COMMANDS |
||||
Xpdf's key and mouse bindings are user-configurable, using the bind and |
||||
unbind options in the config file (see xpdfrc(5)). The bind command |
||||
allows you to bind a key or mouse button to a sequence of one or more |
||||
commands. |
||||
|
||||
Available Commands |
||||
The following commands are supported: |
||||
|
||||
gotoPage(page) |
||||
Go to the specified page. |
||||
|
||||
gotoPageNoScroll(page) |
||||
Go to the specified page, with the current relative scroll posi- |
||||
tion. |
||||
|
||||
gotoDest(dest) |
||||
Go to a named destination. |
||||
|
||||
gotoLastPage |
||||
Go to the last page in the PDF file. |
||||
|
||||
gotoLastPageNoScroll |
||||
Go to the last page in the PDF file, with the current relative |
||||
scroll position. |
||||
|
||||
nextPage |
||||
Go to the next page. |
||||
|
||||
nextPageNoScroll |
||||
Go to the next page, with the current relative scroll position. |
||||
|
||||
prevPage |
||||
Go to the previous page. |
||||
|
||||
prevPageNoScroll |
||||
Go to the previous page, with the current relative scroll posi- |
||||
tion. |
||||
|
||||
pageUp Scroll up by one screenful. |
||||
|
||||
pageDown |
||||
Scroll down by one screenful. |
||||
|
||||
scrollLeft(n) |
||||
Scroll left by n pixels. |
||||
|
||||
scrollRight(n) |
||||
Scroll right by n pixels. |
||||
|
||||
scrollUp(n) |
||||
Scroll up by n pixels. |
||||
|
||||
scrollDown(n) |
||||
Scroll down by n pixels. |
||||
|
||||
scrollUpPrevPage(n) |
||||
Scroll up by n pixels, moving to the previous page if appropri- |
||||
ate. |
||||
|
||||
scrollDownPrevPage(n) |
||||
Scroll down by n pixels, moving to the next page if appropriate. |
||||
|
||||
scrollToTopEdge |
||||
Scroll to the top edge of the current page, with no horizontal |
||||
movement. |
||||
|
||||
scrollToBottomEdge |
||||
Scroll to the bottom edge of the current page, with no horizon- |
||||
tal movement. |
||||
|
||||
scrollToLeftEdge |
||||
Scroll to the left edge of the current page, with no vertical |
||||
movement. |
||||
|
||||
scrollToRightEdge |
||||
Scroll to the right edge of the current page, with no vertical |
||||
movement. |
||||
|
||||
scrollToTopLeft |
||||
Scroll to the top-left corner of the current page. |
||||
|
||||
scrollToBottomRight |
||||
Scroll to the bottom-right corner of the current page. |
||||
|
||||
goForward |
||||
Move forward along the history path. |
||||
|
||||
goBackward |
||||
Move backward along the history path. |
||||
|
||||
zoomPercent(z) |
||||
Set the zoom factor to z%. |
||||
|
||||
zoomFitPage |
||||
Set the zoom factor to fit-page. |
||||
|
||||
zoomFitWidth |
||||
Set the zoom factor to fit-width. |
||||
|
||||
zoomIn Zoom in - go to the next higher zoom factor. |
||||
|
||||
zoomOut |
||||
Zoom out - go the next lower zoom factor. |
||||
|
||||
rotateCW |
||||
Rotate the page 90 degrees clockwise. |
||||
|
||||
rotateCCW |
||||
Rotate the page 90 degrees counterclockwise. |
||||
|
||||
setSelection(pg,ulx,uly,lrx,lry) |
||||
Set the selection to the specified coordinates on the specified |
||||
page. |
||||
|
||||
continuousMode |
||||
Go to continuous view mode. |
||||
|
||||
singlePageMode |
||||
Go to single-page view mode. |
||||
|
||||
toggleContinuousMode |
||||
Toggle between continuous and single page view modes. |
||||
|
||||
fullScreenMode |
||||
Go to full-screen mode. |
||||
|
||||
windowMode |
||||
Go to window (non-full-screen) mode. |
||||
|
||||
toggleFullScreenMode |
||||
Toggle between full-screen and window modes. |
||||
|
||||
open Open a PDF file in this window, using the open dialog. |
||||
|
||||
openInNewWin |
||||
Open a PDF file in a new window, using the open dialog. |
||||
|
||||
openFile(file) |
||||
Open a specified PDF file in this window. |
||||
|
||||
openFileInNewWin(file) |
||||
Open a specified PDF file in a new window. |
||||
|
||||
openFileAtDest(file,dest) |
||||
Open a specified PDF file in this window and go to a named des- |
||||
tination. |
||||
|
||||
openFileAtDestInNewWin(file,dest) |
||||
Open a specified PDF file in a new window and go to a named des- |
||||
tination. |
||||
|
||||
reload Reload the current PDF file. |
||||
|
||||
redraw Redraw the window. |
||||
|
||||
raise Raise the window to the front. |
||||
|
||||
closeWindow |
||||
Close the window. |
||||
|
||||
run(external-command-string) |
||||
Run an external command. The following escapes are allowed in |
||||
the command string: |
||||
|
||||
%f => PDF file name (or an empty string if no |
||||
file is open) |
||||
%b => PDF file base name, i.e., file name minus |
||||
the extension (or an empty string if no |
||||
file is open) |
||||
%u => link URL (or an empty string if not over |
||||
a URL link) |
||||
%p => current page number (or an empty string if |
||||
no file is open) |
||||
%x => selection upper-left x coordinate |
||||
(or 0 if there is no selection) |
||||
%y => selection upper-left y coordinate |
||||
(or 0 if there is no selection) |
||||
%X => selection lower-right x coordinate |
||||
(or 0 if there is no selection) |
||||
%Y => selection lower-right y coordinate |
||||
(or 0 if there is no selection) |
||||
%% => % |
||||
|
||||
|
||||
openOutline |
||||
Open the outline pane. |
||||
|
||||
closeOutline |
||||
Close the outline pane. |
||||
|
||||
toggleOutline |
||||
Toggle the outline pane between open and closed. |
||||
|
||||
scrollOutlineDown(n) |
||||
Scroll the outline down by n increments. |
||||
|
||||
scrollOutlineUp(n) |
||||
Scroll the outline up by n increments. |
||||
|
||||
focusToDocWin |
||||
Set the keyboard focus to the main document window. |
||||
|
||||
focusToPageNum |
||||
Set the keyboard focus to the page number text box. |
||||
|
||||
find Open the 'find' dialog. |
||||
|
||||
findNext |
||||
Finds the next occurrence of the search string (no dialog). |
||||
|
||||
print Open the 'print' dialog. |
||||
|
||||
about Open the 'about' dialog. |
||||
|
||||
quit Quit from xpdf. |
||||
|
||||
The following commands depend on the current mouse position: |
||||
|
||||
startSelection |
||||
Start a selection, which will be extended as the mouse moves. |
||||
|
||||
endSelection |
||||
End a selection. |
||||
|
||||
startPan |
||||
Start a pan, which will scroll the document as the mouse moves |
||||
|
||||
endPan End a pan. |
||||
|
||||
postPopupMenu |
||||
Display the popup menu. |
||||
|
||||
followLink |
||||
Follow a hyperlink (does nothing if the mouse is not over a |
||||
link). |
||||
|
||||
followLinkInNewWin |
||||
Follow a hyperlink, opening PDF files in a new window (does |
||||
nothing if the mouse is not over a link). For links to non-PDF |
||||
files, this command is identical to followLink. |
||||
|
||||
followLinkNoSel |
||||
Same as followLink, but does nothing if there is a non-empty |
||||
selection. (This is useful as a mouse button binding.) |
||||
|
||||
followLinkInNewWinNoSel |
||||
Same as followLinkInNewWin, but does nothing if there is a non- |
||||
empty selection. (This is useful as a mouse button binding.) |
||||
|
||||
Default Bindings |
||||
The default mouse bindings are as follows: |
||||
|
||||
bind mousePress1 any startSelection |
||||
bind mouseRelease1 any endSelection followLinkNoSel |
||||
bind mousePress2 any startPan |
||||
bind mouseRelease2 any endPan |
||||
bind mousePress3 any postPopupMenu |
||||
bind mousePress4 any scrollUpPrevPage(16) |
||||
bind mousePress5 any scrollDownNextPage(16) |
||||
bind mousePress6 any scrollLeft(16) |
||||
bind mousePress7 any scrollRight(16) |
||||
|
||||
The default key bindings are as follows: |
||||
|
||||
bind ctrl-home any gotoPage(1) |
||||
bind home any scrollToTopLeft |
||||
bind ctrl-end any gotoLastPage |
||||
bind end any scrollToBottomRight |
||||
bind pgup any pageUp |
||||
bind backspace any pageUp |
||||
bind delete any pageUp |
||||
bind pgdn any pageDown |
||||
bind space any pageDown |
||||
bind left any scrollLeft(16) |
||||
bind right any scrollRight(16) |
||||
bind up any scrollUp(16) |
||||
bind down any scrollDown(16) |
||||
bind o any open |
||||
bind O any open |
||||
bind r any reload |
||||
bind R any reload |
||||
bind f any find |
||||
bind F any find |
||||
bind ctrl-f any find |
||||
bind ctrl-g any findNext |
||||
bind ctrl-p any print |
||||
bind n scrLockOff nextPage |
||||
bind N scrLockOff nextPage |
||||
bind n scrLockOn nextPageNoScroll |
||||
bind N scrLockOn nextPageNoScroll |
||||
bind p scrLockOff prevPage |
||||
bind P scrLockOff prevPage |
||||
bind p scrLockOn prevPageNoScroll |
||||
bind P scrLockOn prevPageNoScroll |
||||
bind v any goForward |
||||
bind b any goBackward |
||||
bind g any focusToPageNum |
||||
bind 0 any zoomPercent(125) |
||||
bind + any zoomIn |
||||
bind - any zoomOut |
||||
bind z any zoomFitPage |
||||
bind w any zoomFitWidth |
||||
bind alt-f any toggleFullScreenMode |
||||
bind ctrl-l any redraw |
||||
bind ctrl-w any closeWindow |
||||
bind ? any about |
||||
bind q any quit |
||||
bind Q any quit |
||||
|
||||
Previous versions of xpdf included a "viKeys" X resource. It is no |
||||
longer available, but the following bindings are equivalent: |
||||
|
||||
bind h any scrollLeft(16) |
||||
bind l any scrollRight(16) |
||||
bind k any scrollUp(16) |
||||
bind j any scrollDown(16) |
||||
|
||||
|
||||
REMOTE SERVER MODE |
||||
Xpdf can be started in remote server mode by specifying a server name |
||||
(in addition to the file name and page number). For example: |
||||
|
||||
xpdf -remote myServer file.pdf |
||||
|
||||
If there is currently no xpdf running in server mode with the name |
||||
'myServer', a new xpdf window will be opened. If another command: |
||||
|
||||
xpdf -remote myServer another.pdf 9 |
||||
|
||||
is issued, a new copy of xpdf will not be started. Instead, the first |
||||
xpdf (the server) will load another.pdf and display page nine. If the |
||||
file name is the same: |
||||
|
||||
xpdf -remote myServer another.pdf 4 |
||||
|
||||
the xpdf server will simply display the specified page. |
||||
|
||||
The -raise option tells the server to raise its window; it can be spec- |
||||
ified with or without a file name and page number. |
||||
|
||||
The -quit option tells the server to close its window and exit. |
||||
|
||||
EXIT CODES |
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
AUTHOR |
||||
The xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 xpdf(1) |
@ -1,779 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 xpdf |
||||
|
||||
xpdf - Portable Document Format (PDF) file viewer for X (version 3.02) |
||||
|
||||
xpdf [options] [PDF-file [page | +dest]] |
||||
|
||||
Xpdf is a viewer for Portable Document Format (PDF) files. (These are |
||||
also sometimes also called 'Acrobat' files, from the name of Adobe's |
||||
PDF software.) Xpdf runs under the X Window System on UNIX, VMS, and |
||||
OS/2. |
||||
|
||||
To run xpdf, simply type: |
||||
|
||||
xpdf file.pdf |
||||
|
||||
where file.pdf is your PDF file. The file name can be followed by a |
||||
number specifying the page which should be displayed first, e.g.: |
||||
|
||||
xpdf file.pdf 18 |
||||
|
||||
You can also give a named destination, prefixed with '+' in place of |
||||
the page number. (This is only useful with PDF files that provide |
||||
named destination targets.) |
||||
|
||||
You can also start xpdf without opening any files: |
||||
|
||||
xpdf |
||||
|
||||
() |
||||
|
||||
2 ONFIGURATION_FIL |
||||
|
||||
Xpdf reads a configuration file at startup. It first tries to find the |
||||
user's private config file, ~/.xpdfrc. If that doesn't exist, it looks |
||||
for a system-wide config file, typically /usr/local/etc/xpdfrc (but |
||||
this location can be changed when xpdf is built). See the xpdfrc(5) |
||||
man page for details. |
||||
|
||||
() |
||||
|
||||
2 OPTIONS |
||||
|
||||
Many of the following options can be set with configuration file com- |
||||
mands or X resources. These are listed in square brackets with the |
||||
description of the corresponding command line option. |
||||
|
||||
-g geometry |
||||
Set the initial window geometry. (-geometry is equivalent.) [X |
||||
resource: xpdf.geometry] |
||||
|
||||
-title title |
||||
Set the window title. By default, the title will be "xpdf: |
||||
foo.pdf". [X resource: xpdf.title] |
||||
|
||||
-cmap Install a private colormap. This is ignored on TrueColor visu- |
||||
als. [X resource: xpdf.installCmap] |
||||
|
||||
-rgb number |
||||
Set the size of largest RGB cube xpdf will try to allocate. The |
||||
default is 5 (for a 5x5x5 cube); set to a smaller number to con- |
||||
serve color table entries. This is ignored with private col- |
||||
ormaps and on TrueColor visuals. [X resource: xpdf.rgbCubeSize] |
||||
|
||||
-rv Set reverse video mode. This reverses the colors of everything |
||||
except images. It may not always produce great results for PDF |
||||
files which do weird things with color. This also causes the |
||||
paper color to default to black. [X resource: xpdf.reverseV- |
||||
ideo] |
||||
|
||||
-papercolor color |
||||
Set the "paper color", i.e., the background of the page display. |
||||
This will not work too well with PDF files that do things like |
||||
filling in white behind the text. [X resource: xpdf.paperColor] |
||||
|
||||
-mattecolor color |
||||
Set the matte color, i.e., the color used for background outside |
||||
the actual page area. (There is a separate setting, |
||||
xpdf.fullScreenMatteColor, for full-screen mode.) [X resource: |
||||
xpdf.matteColor] |
||||
|
||||
-z zoom |
||||
Set the initial zoom factor. A number specifies a zoom percent- |
||||
age, where 100 means 72 dpi.You may also specify 'page', to fit |
||||
the page to the window size, or 'width', to fit the page width |
||||
to the window width. [config file: initialZoom; or X resource: |
||||
xpdf.initialZoom] |
||||
|
||||
-cont Start in continuous view mode, i.e., with one vertical scroll |
||||
bar for the whole document. [config file: continuousView] |
||||
|
||||
-t1lib yes | no |
||||
Enable or disable t1lib (a Type 1 font rasterizer). This |
||||
defaults to "yes". [config file: enableT1lib] |
||||
|
||||
-freetype yes | no |
||||
Enable or disable FreeType (a TrueType / Type 1 font raster- |
||||
izer). This defaults to "yes". [config file: enableFreeType] |
||||
|
||||
-aa yes | no |
||||
Enable or disable font anti-aliasing. This defaults to "yes". |
||||
[config file: antialias] |
||||
|
||||
-aaVector yes | no |
||||
Enable or disable vector anti-aliasing. This defaults to "yes". |
||||
[config file: vectorAntialias] |
||||
|
||||
-ps PS-file |
||||
Set the default file name for PostScript output (i.e., the name |
||||
which will appear in the print dialog). This can also be of the |
||||
form '|command' to pipe the PostScript through a command. [con- |
||||
fig file: psFile] |
||||
|
||||
-paper size |
||||
Set the paper size to one of "letter", "legal", "A4", or "A3". |
||||
This can also be set to "match", which will set the paper size |
||||
to match the size specified in the PDF file. [config file: |
||||
psPaperSize] |
||||
|
||||
-paperw size |
||||
Set the paper width, in points. [config file: psPaperSize] |
||||
|
||||
-paperh size |
||||
Set the paper height, in points. [config file: psPaperSize] |
||||
|
||||
-level1 |
||||
Generate Level 1 PostScript. The resulting PostScript files |
||||
will be significantly larger (if they contain images), but will |
||||
print on Level 1 printers. This also converts all images to |
||||
black and white. [config file: psLevel] |
||||
|
||||
-enc encoding-name |
||||
Sets the encoding to use for text output. The encoding-name |
||||
must be defined with the unicodeMap command (see xpdfrc(5)). |
||||
This defaults to "Latin1" (which is a built-in encoding). [con- |
||||
fig file: textEncoding] |
||||
|
||||
-eol unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. [config |
||||
file: textEOL] |
||||
|
||||
-opw password |
||||
Specify the owner password for the PDF file. Providing this |
||||
will bypass all security restrictions. |
||||
|
||||
-upw password |
||||
Specify the user password for the PDF file. |
||||
|
||||
-fullscreen |
||||
Open xpdf in full-screen mode, useful for presentations. |
||||
|
||||
-remote name |
||||
Start/contact xpdf remote server with specified name (see the |
||||
REMOTE SERVER MODE section below). |
||||
|
||||
-exec command |
||||
Execute a command (see the COMMANDS section below) in an xpdf |
||||
remote server window (with -remote only). |
||||
|
||||
-reload |
||||
Reload xpdf remote server window (with -remote only). |
||||
|
||||
-raise Raise xpdf remote server window (with -remote only). |
||||
|
||||
-quit Kill xpdf remote server (with -remote only). |
||||
|
||||
-cmd Print commands as they're executed (useful for debugging). |
||||
[config file: printCommands] |
||||
|
||||
-q Don't print any messages or errors. [config file: errQuiet] |
||||
|
||||
-cfg config-file |
||||
Read config-file in place of ~/.xpdfrc or the system-wide config |
||||
file. |
||||
|
||||
-v Print copyright and version information. |
||||
|
||||
-h Print usage information. (-help and --help are equivalent.) |
||||
|
||||
Several other standard X options and resources will work as expected: |
||||
|
||||
-display display |
||||
[X resource: xpdf.display] |
||||
|
||||
-fg color |
||||
(-foreground is equivalent.) [X resource: xpdf*Foreground] |
||||
|
||||
-bg color |
||||
(-background is equivalent.) [X resource: xpdf*Background] |
||||
|
||||
-font font |
||||
(-fn is equivalent.) [X resource: xpdf*fontList] |
||||
|
||||
The color and font options only affect the user interface elements, not |
||||
the PDF display (the 'paper'). |
||||
|
||||
The following X resources do not have command line option equivalents: |
||||
|
||||
xpdf.toolTipEnable |
||||
Enables (if set to true) or disables (if set to false) the tool- |
||||
tips on the toolbar buttons. |
||||
|
||||
xpdf.fullScreenMatteColor |
||||
Sets the matte color to be used in full-screen mode. The |
||||
default setting is "black". |
||||
|
||||
() |
||||
|
||||
2 CONTROLS |
||||
|
||||
On-screen controls, at the bottom of the xpdf window |
||||
left/right arrow buttons |
||||
Move to the previous/next page. |
||||
|
||||
double left/right arrow buttons |
||||
Move backward or forward by ten pages. |
||||
|
||||
dashed left/right arrow buttons |
||||
Move backward or forward along the history path. |
||||
|
||||
'Page' entry box |
||||
Move to a specific page number. Click in the box to activate |
||||
it, type the page number, then hit return. |
||||
|
||||
zoom popup menu |
||||
Change the zoom factor (see the description of the -z option |
||||
above). |
||||
|
||||
binoculars button |
||||
Find a text string. |
||||
|
||||
print button |
||||
Bring up a dialog for generating a PostScript file. The dialog |
||||
has options to set the pages to be printed and the PostScript |
||||
file name. The file name can be '-' for stdout or '|command' to |
||||
pipe the PostScript through a command, e.g., '|lpr'. |
||||
|
||||
'?' button |
||||
Bring up the 'about xpdf' window. |
||||
|
||||
link info |
||||
The space between the '?' and 'Quit' buttons is used to show the |
||||
URL or external file name when the mouse is over a link. |
||||
|
||||
'Quit' button |
||||
Quit xpdf. |
||||
|
||||
Menu |
||||
Pressing the right mouse button will post a popup menu with the follow- |
||||
ing commands: |
||||
|
||||
Open... |
||||
Open a new PDF file via a file requester. |
||||
|
||||
Open in new window... |
||||
Create a new window and open a new PDF file via a file |
||||
requester. |
||||
|
||||
Reload Reload the current PDF file. Note that Xpdf will reload the |
||||
file automatically (on a page change or redraw) if it has |
||||
changed since it was last loaded. |
||||
|
||||
Save as... |
||||
Save the current file via a file requester. |
||||
|
||||
Continuous view |
||||
Toggles between single page and continuous view modes. |
||||
|
||||
Rotate counterclockwise |
||||
Rotate the page 90 degrees counterclockwise. |
||||
|
||||
Rotate clockwise |
||||
Rotate the page 90 degrees clockwise. The two rotate commands |
||||
are intended primarily for PDF files where the rotation isn't |
||||
correctly specified in the file. |
||||
|
||||
Zoom to selection |
||||
Zoom in to the currently selected rectangle. |
||||
|
||||
Close Close the current window. If this is the only open window, the |
||||
document is closed, but the window is left open (i.e., this menu |
||||
command won't quit xpdf). |
||||
|
||||
Quit Quit xpdf. |
||||
|
||||
Outline |
||||
If the PDF contains an outline (a.k.a., bookmarks), there will be an |
||||
outline pane on the left side of the window. The width of the outline |
||||
pane is adjustable with a vertical split bar via the knob near its bot- |
||||
tom end. |
||||
|
||||
Text selection |
||||
Dragging the mouse with the left button held down will highlight an |
||||
arbitrary rectangle. Any text inside this rectangle will be copied to |
||||
the X selection buffer. |
||||
|
||||
Links |
||||
Clicking on a hyperlink will jump to the link's destination. A link to |
||||
another PDF document will make xpdf load that document. A 'launch' |
||||
link to an executable program will display a dialog, and if you click |
||||
'ok', execute the program. URL links call an external command (see the |
||||
WEB BROWSERS section below). |
||||
|
||||
Panning |
||||
Dragging the mouse with the middle button held down pans the window. |
||||
|
||||
Key bindings |
||||
o Open a new PDF file via a file requester. |
||||
|
||||
r Reload the current PDF file. Note that Xpdf will reload the |
||||
file automatically (on a page change or redraw) if it has |
||||
changed since it was last loaded. |
||||
|
||||
control-L |
||||
Redraw the current page. |
||||
|
||||
control-W |
||||
Close the current window. |
||||
|
||||
f or control-F |
||||
Find a text string. |
||||
|
||||
control-G |
||||
Find next occurrence. |
||||
|
||||
control-P |
||||
Print. |
||||
|
||||
n Move to the next page. Scrolls to the top of the page, unless |
||||
scroll lock is turned on. |
||||
|
||||
p Move to the previous page. Scrolls to the top of the page, |
||||
unless scroll lock is turned on. |
||||
|
||||
<Space> or <PageDown> or <Next> |
||||
Scroll down on the current page; if already at bottom, move to |
||||
next page. |
||||
|
||||
<Backspace> or <Delete> or <PageUp> or <Previous> |
||||
Scroll up on the current page; if already at top, move to previ- |
||||
ous page. |
||||
|
||||
v Move forward along the history path. |
||||
|
||||
b Move backward along the history path. |
||||
|
||||
<Home> Scroll to top of current page. |
||||
|
||||
<End> Scroll to bottom of current page. |
||||
|
||||
control-<Home> |
||||
Scroll to first page of document. |
||||
|
||||
control-<End> |
||||
Scroll to last page of document. |
||||
|
||||
arrows Scroll the current page. |
||||
|
||||
g Activate the page number text field ("goto page"). |
||||
|
||||
0 Set the zoom factor to 125%. |
||||
|
||||
+ Zoom in (increment the zoom factor by 1). |
||||
|
||||
- Zoom out (decrement the zoom factor by 1). |
||||
|
||||
z Set the zoom factor to 'page' (fit page to window). |
||||
|
||||
w Set the zoom factor to 'width' (fit page width to window). |
||||
|
||||
alt-F Toggle full-screen mode. |
||||
|
||||
q Quit xpdf. |
||||
|
||||
() |
||||
|
||||
2 WEB_BROWSERS |
||||
|
||||
If you want to run xpdf automatically from netscape or mosaic (and |
||||
probably other browsers) when you click on a link to a PDF file, you |
||||
need to edit (or create) the files .mime.types and .mailcap in your |
||||
home directory. In .mime.types add the line: |
||||
|
||||
application/pdf pdf |
||||
|
||||
In .mailcap add the lines: |
||||
|
||||
# Use xpdf to view PDF files. |
||||
application/pdf; xpdf -q %s |
||||
|
||||
Make sure that xpdf is on your executable search path. |
||||
|
||||
When you click on a URL link in a PDF file, xpdf will execute the com- |
||||
mand specified by the urlCommand config file option, replacing an |
||||
occurrence of '%s' with the URL. For example, to call netscape with |
||||
the URL, add this line to your config file: |
||||
|
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
|
||||
() |
||||
|
||||
2 COMMANDS |
||||
|
||||
Xpdf's key and mouse bindings are user-configurable, using the bind and |
||||
unbind options in the config file (see xpdfrc(5)). The bind command |
||||
allows you to bind a key or mouse button to a sequence of one or more |
||||
commands. |
||||
|
||||
Available Commands |
||||
The following commands are supported: |
||||
|
||||
gotoPage(page) |
||||
Go to the specified page. |
||||
|
||||
gotoPageNoScroll(page) |
||||
Go to the specified page, with the current relative scroll posi- |
||||
tion. |
||||
|
||||
gotoDest(dest) |
||||
Go to a named destination. |
||||
|
||||
gotoLastPage |
||||
Go to the last page in the PDF file. |
||||
|
||||
gotoLastPageNoScroll |
||||
Go to the last page in the PDF file, with the current relative |
||||
scroll position. |
||||
|
||||
nextPage |
||||
Go to the next page. |
||||
|
||||
nextPageNoScroll |
||||
Go to the next page, with the current relative scroll position. |
||||
|
||||
prevPage |
||||
Go to the previous page. |
||||
|
||||
prevPageNoScroll |
||||
Go to the previous page, with the current relative scroll posi- |
||||
tion. |
||||
|
||||
pageUp Scroll up by one screenful. |
||||
|
||||
pageDown |
||||
Scroll down by one screenful. |
||||
|
||||
scrollLeft(n) |
||||
Scroll left by n pixels. |
||||
|
||||
scrollRight(n) |
||||
Scroll right by n pixels. |
||||
|
||||
scrollUp(n) |
||||
Scroll up by n pixels. |
||||
|
||||
scrollDown(n) |
||||
Scroll down by n pixels. |
||||
|
||||
scrollUpPrevPage(n) |
||||
Scroll up by n pixels, moving to the previous page if appropri- |
||||
ate. |
||||
|
||||
scrollDownPrevPage(n) |
||||
Scroll down by n pixels, moving to the next page if appropriate. |
||||
|
||||
scrollToTopEdge |
||||
Scroll to the top edge of the current page, with no horizontal |
||||
movement. |
||||
|
||||
scrollToBottomEdge |
||||
Scroll to the bottom edge of the current page, with no horizon- |
||||
tal movement. |
||||
|
||||
scrollToLeftEdge |
||||
Scroll to the left edge of the current page, with no vertical |
||||
movement. |
||||
|
||||
scrollToRightEdge |
||||
Scroll to the right edge of the current page, with no vertical |
||||
movement. |
||||
|
||||
scrollToTopLeft |
||||
Scroll to the top-left corner of the current page. |
||||
|
||||
scrollToBottomRight |
||||
Scroll to the bottom-right corner of the current page. |
||||
|
||||
goForward |
||||
Move forward along the history path. |
||||
|
||||
goBackward |
||||
Move backward along the history path. |
||||
|
||||
zoomPercent(z) |
||||
Set the zoom factor to z%. |
||||
|
||||
zoomFitPage |
||||
Set the zoom factor to fit-page. |
||||
|
||||
zoomFitWidth |
||||
Set the zoom factor to fit-width. |
||||
|
||||
zoomIn Zoom in - go to the next higher zoom factor. |
||||
|
||||
zoomOut |
||||
Zoom out - go the next lower zoom factor. |
||||
|
||||
rotateCW |
||||
Rotate the page 90 degrees clockwise. |
||||
|
||||
rotateCCW |
||||
Rotate the page 90 degrees counterclockwise. |
||||
|
||||
setSelection(pg,ulx,uly,lrx,lry) |
||||
Set the selection to the specified coordinates on the specified |
||||
page. |
||||
|
||||
continuousMode |
||||
Go to continuous view mode. |
||||
|
||||
singlePageMode |
||||
Go to single-page view mode. |
||||
|
||||
toggleContinuousMode |
||||
Toggle between continuous and single page view modes. |
||||
|
||||
fullScreenMode |
||||
Go to full-screen mode. |
||||
|
||||
windowMode |
||||
Go to window (non-full-screen) mode. |
||||
|
||||
toggleFullScreenMode |
||||
Toggle between full-screen and window modes. |
||||
|
||||
open Open a PDF file in this window, using the open dialog. |
||||
|
||||
openInNewWin |
||||
Open a PDF file in a new window, using the open dialog. |
||||
|
||||
openFile(file) |
||||
Open a specified PDF file in this window. |
||||
|
||||
openFileInNewWin(file) |
||||
Open a specified PDF file in a new window. |
||||
|
||||
openFileAtDest(file,dest) |
||||
Open a specified PDF file in this window and go to a named des- |
||||
tination. |
||||
|
||||
openFileAtDestInNewWin(file,dest) |
||||
Open a specified PDF file in a new window and go to a named des- |
||||
tination. |
||||
|
||||
reload Reload the current PDF file. |
||||
|
||||
redraw Redraw the window. |
||||
|
||||
raise Raise the window to the front. |
||||
|
||||
closeWindow |
||||
Close the window. |
||||
|
||||
run(external-command-string) |
||||
Run an external command. The following escapes are allowed in |
||||
the command string: |
||||
|
||||
%f => PDF file name (or an empty string if no |
||||
file is open) |
||||
%b => PDF file base name, i.e., file name minus |
||||
the extension (or an empty string if no |
||||
file is open) |
||||
%u => link URL (or an empty string if not over |
||||
a URL link) |
||||
%p => current page number (or an empty string if |
||||
no file is open) |
||||
%x => selection upper-left x coordinate |
||||
(or 0 if there is no selection) |
||||
%y => selection upper-left y coordinate |
||||
(or 0 if there is no selection) |
||||
%X => selection lower-right x coordinate |
||||
(or 0 if there is no selection) |
||||
%Y => selection lower-right y coordinate |
||||
(or 0 if there is no selection) |
||||
%% => % |
||||
|
||||
openOutline |
||||
Open the outline pane. |
||||
|
||||
closeOutline |
||||
Close the outline pane. |
||||
|
||||
toggleOutline |
||||
Toggle the outline pane between open and closed. |
||||
|
||||
scrollOutlineDown(n) |
||||
Scroll the outline down by n increments. |
||||
|
||||
scrollOutlineUp(n) |
||||
Scroll the outline up by n increments. |
||||
|
||||
focusToDocWin |
||||
Set the keyboard focus to the main document window. |
||||
|
||||
focusToPageNum |
||||
Set the keyboard focus to the page number text box. |
||||
|
||||
find Open the 'find' dialog. |
||||
|
||||
findNext |
||||
Finds the next occurrence of the search string (no dialog). |
||||
|
||||
print Open the 'print' dialog. |
||||
|
||||
about Open the 'about' dialog. |
||||
|
||||
quit Quit from xpdf. |
||||
|
||||
The following commands depend on the current mouse position: |
||||
|
||||
startSelection |
||||
Start a selection, which will be extended as the mouse moves. |
||||
|
||||
endSelection |
||||
End a selection. |
||||
|
||||
startPan |
||||
Start a pan, which will scroll the document as the mouse moves |
||||
|
||||
endPan End a pan. |
||||
|
||||
postPopupMenu |
||||
Display the popup menu. |
||||
|
||||
followLink |
||||
Follow a hyperlink (does nothing if the mouse is not over a |
||||
link). |
||||
|
||||
followLinkInNewWin |
||||
Follow a hyperlink, opening PDF files in a new window (does |
||||
nothing if the mouse is not over a link). For links to non-PDF |
||||
files, this command is identical to followLink. |
||||
|
||||
followLinkNoSel |
||||
Same as followLink, but does nothing if there is a non-empty |
||||
selection. (This is useful as a mouse button binding.) |
||||
|
||||
followLinkInNewWinNoSel |
||||
Same as followLinkInNewWin, but does nothing if there is a non- |
||||
empty selection. (This is useful as a mouse button binding.) |
||||
|
||||
Default Bindings |
||||
The default mouse bindings are as follows: |
||||
|
||||
bind mousePress1 any startSelection |
||||
bind mouseRelease1 any endSelection followLinkNoSel |
||||
bind mousePress2 any startPan |
||||
bind mouseRelease2 any endPan |
||||
bind mousePress3 any postPopupMenu |
||||
bind mousePress4 any scrollUpPrevPage(16) |
||||
bind mousePress5 any scrollDownNextPage(16) |
||||
bind mousePress6 any scrollLeft(16) |
||||
bind mousePress7 any scrollRight(16) |
||||
|
||||
The default key bindings are as follows: |
||||
|
||||
bind ctrl-home any gotoPage(1) |
||||
bind home any scrollToTopLeft |
||||
bind ctrl-end any gotoLastPage |
||||
bind end any scrollToBottomRight |
||||
bind pgup any pageUp |
||||
bind backspace any pageUp |
||||
bind delete any pageUp |
||||
bind pgdn any pageDown |
||||
bind space any pageDown |
||||
bind left any scrollLeft(16) |
||||
bind right any scrollRight(16) |
||||
bind up any scrollUp(16) |
||||
bind down any scrollDown(16) |
||||
bind o any open |
||||
bind O any open |
||||
bind r any reload |
||||
bind R any reload |
||||
bind f any find |
||||
bind F any find |
||||
bind ctrl-f any find |
||||
bind ctrl-g any findNext |
||||
bind ctrl-p any print |
||||
bind n scrLockOff nextPage |
||||
bind N scrLockOff nextPage |
||||
bind n scrLockOn nextPageNoScroll |
||||
bind N scrLockOn nextPageNoScroll |
||||
bind p scrLockOff prevPage |
||||
bind P scrLockOff prevPage |
||||
bind p scrLockOn prevPageNoScroll |
||||
bind P scrLockOn prevPageNoScroll |
||||
bind v any goForward |
||||
bind b any goBackward |
||||
bind g any focusToPageNum |
||||
bind 0 any zoomPercent(125) |
||||
bind + any zoomIn |
||||
bind - any zoomOut |
||||
bind z any zoomFitPage |
||||
bind w any zoomFitWidth |
||||
bind alt-f any toggleFullScreenMode |
||||
bind ctrl-l any redraw |
||||
bind ctrl-w any closeWindow |
||||
bind ? any about |
||||
bind q any quit |
||||
bind Q any quit |
||||
|
||||
Previous versions of xpdf included a "viKeys" X resource. It is no |
||||
longer available, but the following bindings are equivalent: |
||||
|
||||
bind h any scrollLeft(16) |
||||
bind l any scrollRight(16) |
||||
bind k any scrollUp(16) |
||||
bind j any scrollDown(16) |
||||
|
||||
() |
||||
|
||||
2 REMOTE_SERVER_MODE |
||||
|
||||
Xpdf can be started in remote server mode by specifying a server name |
||||
(in addition to the file name and page number). For example: |
||||
|
||||
xpdf -remote myServer file.pdf |
||||
|
||||
If there is currently no xpdf running in server mode with the name |
||||
'myServer', a new xpdf window will be opened. If another command: |
||||
|
||||
xpdf -remote myServer another.pdf 9 |
||||
|
||||
is issued, a new copy of xpdf will not be started. Instead, the first |
||||
xpdf (the server) will load another.pdf and display page nine. If the |
||||
file name is the same: |
||||
|
||||
xpdf -remote myServer another.pdf 4 |
||||
|
||||
the xpdf server will simply display the specified page. |
||||
|
||||
The -raise option tells the server to raise its window; it can be spec- |
||||
ified with or without a file name and page number. |
||||
|
||||
The -quit option tells the server to close its window and exit. |
||||
|
||||
() |
||||
|
||||
2 XIT_CODE |
||||
|
||||
The Xpdf tools use the following exit codes: |
||||
|
||||
0 No error. |
||||
|
||||
1 Error opening a PDF file. |
||||
|
||||
2 Error opening an output file. |
||||
|
||||
3 Error related to PDF permissions. |
||||
|
||||
99 Other error. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
pdftops(1), pdftotext(1), pdfinfo(1), pdffonts(1), pdftoppm(1), pdfim- |
||||
ages(1), xpdfrc(5) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,662 +0,0 @@ |
||||
.\" Copyright 2002-2007 Glyph & Cog, LLC |
||||
.TH xpdfrc 5 "27 February 2007" |
||||
.SH NAME |
||||
xpdfrc \- configuration file for Xpdf tools (version 3.02) |
||||
.SH DESCRIPTION |
||||
All of the Xpdf tools read a single configuration file. If you have a |
||||
.I .xpdfrc |
||||
file in your home directory, it will be read. Otherwise, a |
||||
system-wide configuration file will be read from |
||||
.IR /usr/local/etc/xpdfrc , |
||||
if it exists. (This is its default location; depending on build |
||||
options, it may be placed elsewhere.) On Win32 systems, the |
||||
.I xpdfrc |
||||
file should be placed in the same directory as the executables. |
||||
.PP |
||||
The xpdfrc file consists of a series of configuration options, one |
||||
per line. Blank lines and lines starting with a \'#' (comments) are |
||||
ignored. |
||||
.PP |
||||
The following sections list all of the configuration options, sorted |
||||
into functional groups. There is an examples section at the end. |
||||
.SH INCLUDE FILES |
||||
.TP |
||||
.BI include " config\-file" |
||||
Includes the specified config file. The effect of this is equivalent |
||||
to inserting the contents of |
||||
.I config\-file |
||||
directly into the parent config file in place of the |
||||
.I include |
||||
command. Config files can be nested arbitrarily deeply. |
||||
.SH CHARACTER MAPPING |
||||
.TP |
||||
.BI nameToUnicode " map\-file" |
||||
Specifies a file with the mapping from character names to Unicode. |
||||
This is used to handle PDF fonts that have valid encodings but no |
||||
ToUnicode entry. Each line of a nameToUnicode file looks like this: |
||||
|
||||
.I " " hex\-string name |
||||
|
||||
The |
||||
.I hex\-string |
||||
is the Unicode (UCS-2) character index, and |
||||
.I name |
||||
is the corresponding character name. Multiple nameToUnicode files can |
||||
be used; if a character name is given more than once, the code in the |
||||
last specified file is used. There is a built-in default |
||||
nameToUnicode table with all of Adobe's standard character names. |
||||
.TP |
||||
.BI cidToUnicode " registry\-ordering map\-file" |
||||
Specifies the file with the mapping from character collection to |
||||
Unicode. Each line of a cidToUnicode file represents one character: |
||||
|
||||
.I " " hex\-string |
||||
|
||||
The |
||||
.I hex\-string |
||||
is the Unicode (UCS-2) index for that character. The first line maps |
||||
CID 0, the second line CID 1, etc. File size is determined by size of |
||||
the character collection. Only one file is allowed per character |
||||
collection; the last specified file is used. There are no built-in |
||||
cidToUnicode mappings. |
||||
.TP |
||||
.BI unicodeToUnicode " font\-name\-substring map\-file" |
||||
This is used to work around PDF fonts which have incorrect Unicode |
||||
information. It specifies a file which maps from the given |
||||
(incorrect) Unicode indexes to the correct ones. The mapping will be |
||||
used for any font whose name contains |
||||
.IR font\-name\-substring . |
||||
Each line of a unicodeToUnicode file represents one Unicode character: |
||||
|
||||
.RI " " in\-hex " " out\-hex1 " " out\-hex2 " ..." |
||||
|
||||
The |
||||
.I in\-hex |
||||
field is an input (incorrect) Unicode index, and the rest of the |
||||
fields are one or more output (correct) Unicode indexes. Each |
||||
occurrence of |
||||
.I in\-hex |
||||
will be converted to the specified output sequence. |
||||
.TP |
||||
.BI unicodeMap " encoding\-name map\-file" |
||||
Specifies the file with mapping from Unicode to |
||||
.IR encoding\-name . |
||||
These encodings are used for X display fonts and text output (see |
||||
below). Each line of a unicodeMap file represents a range of one or |
||||
more Unicode characters which maps linearly to a range in the output |
||||
encoding: |
||||
.nf |
||||
|
||||
.I " " in\-start\-hex in\-end\-hex out\-start\-hex |
||||
|
||||
.fi |
||||
Entries for single characters can be abbreviated to: |
||||
.nf |
||||
|
||||
.I " " in\-hex out\-hex |
||||
|
||||
.fi |
||||
The |
||||
.I in\-start\-hex |
||||
and |
||||
.I in\-end\-hex |
||||
fields (or the single |
||||
.I in\-hex |
||||
field) specify the Unicode range. The |
||||
.I out\-start\-hex |
||||
field (or the |
||||
.I out\-hex |
||||
field) specifies the start of the output encoding range. The length |
||||
of the |
||||
.I out\-start\-hex |
||||
(or |
||||
.IR out\-hex ) |
||||
string determines the length of the output characters (e.g., UTF-8 |
||||
uses different numbers of bytes to represent characters in different |
||||
ranges). Entries must be given in increasing Unicode order. Only one |
||||
file is allowed per encoding; the last specified file is used. The |
||||
.IR Latin1 , |
||||
.IR ASCII7 , |
||||
.IR Symbol , |
||||
.IR ZapfDingbats , |
||||
.IR UTF-8 , |
||||
and |
||||
.I UCS-2 |
||||
encodings are predefined. |
||||
.TP |
||||
.BI cMapDir " registry\-ordering dir" |
||||
Specifies a search directory, |
||||
.IR dir , |
||||
for CMaps for the |
||||
.I registry\-ordering |
||||
character collection. There can be multiple directories for a |
||||
particular collection. There are no default CMap directories. |
||||
.TP |
||||
.BI toUnicodeDir " dir" |
||||
Specifies a search directory, |
||||
.IR dir , |
||||
for ToUnicode CMaps. There can be multiple ToUnicode directories. |
||||
There are no default ToUnicode directories. |
||||
.SH DISPLAY FONTS |
||||
.TP |
||||
.BI displayFontT1 " PDF\-font\-name T1\-file" |
||||
Maps a PDF font, |
||||
.IR PDF\-font\-name , |
||||
to a Type 1 font for display. The Type 1 font file, |
||||
.IR T1\-file , |
||||
should be a standard .pfa or .pfb file. |
||||
.TP |
||||
.BI displayFontTT " PDF\-font\-name TT\-file" |
||||
Maps a PDF font, |
||||
.IR PDF\-font\-name , |
||||
to a TrueType font for display. The TrueType font file, |
||||
.IR TT\-file , |
||||
should be a standard .ttf file. |
||||
.TP |
||||
.BI displayNamedCIDFontT1 " PDF\-font\-name T1\-file" |
||||
Maps a specific PDF CID (16-bit) font, |
||||
.IR PDF\-font\-name , |
||||
to a CID font (16-bit PostScript font), for display. There are no |
||||
default CID font mappings. |
||||
.TP |
||||
.BI displayCIDFontT1 " registry\-ordering T1\-file" |
||||
Maps the |
||||
.I registry\-ordering |
||||
character collection to a CID font (16-bit PostScript font), for |
||||
display. This mapping is used if the font name doesn't match any of |
||||
the fonts declared with displayNamedCIDFont* commands. There are no |
||||
default CID font mappings. |
||||
.TP |
||||
.BI displayNamedCIDFontTT " PDF\-font\-name TT\-file" |
||||
Maps a specific PDF CID (16-bit) font, |
||||
.IR PDF\-font\-name , |
||||
to a (16-bit) TrueType font, for display. There are no default CID |
||||
font mappings. |
||||
.TP |
||||
.BI displayCIDFontTT " registry\-ordering TT\-file" |
||||
Maps the |
||||
.I registry\-ordering |
||||
character collection to a (16-bit) TrueType font, for display. This |
||||
mapping is used if the font name doesn't match any of the fonts |
||||
declared with displayNamedCIDFont* commands. There are no default CID |
||||
font mappings. |
||||
.TP |
||||
.BI fontDir " dir" |
||||
Specifies a search directory for external font files. There can be |
||||
multiple fontDir directories. If a PDF file uses a font but doesn't |
||||
embed it, these directories will be searched for a matching font file. |
||||
These fonts are used by both xpdf (for display) and pdftops (for |
||||
embedding in the generated PostScript). Type 1 fonts must have a |
||||
suffix of ".pfa", ".pfb", ".ps", or no suffix at all. TrueType fonts |
||||
must have a ".ttf" suffix. Other files in these directories will be |
||||
ignored. There are no default fontDir directories. |
||||
.SH POSTSCRIPT CONTROL |
||||
.TP |
||||
.BI psPaperSize " width(pts) height(pts)" |
||||
Sets the paper size for PostScript output. The |
||||
.I width |
||||
and |
||||
.I height |
||||
parameters give the paper size in PostScript points (1 point = 1/72 |
||||
inch). |
||||
.TP |
||||
.BR psPaperSize " letter | legal | A4 | A3 | match" |
||||
Sets the paper size for PostScript output to a standard size. The |
||||
default paper size is set when xpdf and pdftops are built, typically |
||||
to "letter" or "A4". This can also be set to "match", which will set |
||||
the paper size to match the size specified in the PDF file. |
||||
.TP |
||||
.BR psImageableArea " llx lly urx ury" |
||||
Sets the imageable area for PostScript output. The four integers are |
||||
the coordinates of the lower-left and upper-right corners of the |
||||
imageable region, specified in points (with the origin being the |
||||
lower-left corner of the paper). This defaults to the full paper |
||||
size; the psPaperSize option will reset the imageable area |
||||
coordinates. |
||||
.TP |
||||
.BR psCrop " yes | no" |
||||
If set to "yes", PostScript output is cropped to the CropBox specified |
||||
in the PDF file; otherwise no cropping is done. This defaults to |
||||
"yes". |
||||
.TP |
||||
.BR psExpandSmaller " yes | no" |
||||
If set to "yes", PDF pages smaller than the PostScript imageable area |
||||
are expanded to fill the imageable area. Otherwise, no scalling is |
||||
done on smaller pages. This defaults to "no". |
||||
.TP |
||||
.BR psShrinkLarger " yes | no" |
||||
If set to yes, PDF pages larger than the PostScript imageable area are |
||||
shrunk to fit the imageable area. Otherwise, no scaling is done on |
||||
larger pages. This defaults to "yes". |
||||
.TP |
||||
.BR psCenter " yes | no" |
||||
If set to yes, PDF pages smaller than the PostScript imageable area |
||||
(after any scaling) are centered in the imageable area. Otherwise, |
||||
they are aligned at the lower-left corner of the imageable area. This |
||||
defaults to "yes". |
||||
.TP |
||||
.BR psDuplex " yes | no" |
||||
If set to "yes", the generated PostScript will set the "Duplex" |
||||
pagedevice entry. This tells duplex-capable printers to enable |
||||
duplexing. This defaults to "no". |
||||
.TP |
||||
.BR psLevel " level1 | level1sep | level2 | level2sep | level3 | level3Sep" |
||||
Sets the PostScript level to generate. This defaults to "level2". |
||||
.TP |
||||
.BI psFont " PDF\-font\-name PS\-font\-name" |
||||
When the |
||||
.I PDF\-font\-name |
||||
font is used in a PDF file, it will be translated to the PostScript |
||||
font |
||||
.IR PS\-font\-name , |
||||
which is assumed to be resident in the printer. Typically, |
||||
.I PDF\-font\-name |
||||
and |
||||
.I PS\-font\-name |
||||
are the same. By default, only the Base-14 fonts are assumed to be |
||||
resident. |
||||
.TP |
||||
.BI psNamedFont16 " PDF\-font\-name wMode PS\-font\-name encoding" |
||||
When the 16-bit font |
||||
.I PDF\-font\-name |
||||
is used in a PDF file with the |
||||
.I wMode |
||||
writing mode and is not embedded, the |
||||
.I PS\-font\-name |
||||
font is substituted for it. The writing mode must be either \'H' for |
||||
horizontal or \'V' for vertical. The |
||||
.I PS\-font\-name |
||||
font is assumed to be resident in the printer and to use the specified |
||||
encoding (which must have been defined with the unicodeMap command). |
||||
.TP |
||||
.BI psFont16 " registry\-ordering wMode PS\-font\-name encoding" |
||||
When a 16-bit font using the |
||||
.I registry\-ordering |
||||
character collection and |
||||
.I wMode |
||||
writing mode is not embedded and does not match any of the fonts |
||||
declared in psNamedFont16 commands, the |
||||
.I PS\-font\-name |
||||
font is substituted for it. The writing mode must be either \'H' for |
||||
horizontal or \'V' for vertical. The |
||||
.I PS\-font\-name |
||||
font is assumed to be resident in the printer and to use the specified |
||||
writing mode and encoding (which must have been defined with the |
||||
unicodeMap command). |
||||
.TP |
||||
.BR psEmbedType1Fonts " yes | no" |
||||
If set to "no", prevents embedding of Type 1 fonts in generated |
||||
PostScript. This defaults to "yes". |
||||
.TP |
||||
.BR psEmbedTrueTypeFonts " yes | no" |
||||
If set to "no", prevents embedding of TrueType fonts in generated |
||||
PostScript. This defaults to "yes". |
||||
.TP |
||||
.BR psEmbedCIDTrueTypeFonts " yes | no" |
||||
If set to "no", prevents embedding of CID TrueType fonts in generated |
||||
PostScript. For Level 3 PostScript, this generates a CID font, for |
||||
lower levels it generates a non-CID composite font. |
||||
.TP |
||||
.BR psEmbedCIDPostScriptFonts " yes | no" |
||||
If set to "no", prevents embedding of CID PostScript fonts in |
||||
generated PostScript. For Level 3 PostScript, this generates a CID |
||||
font, for lower levels it generates a non-CID composite font. |
||||
.TP |
||||
.BR psFontPassthrough " yes | no" |
||||
If set to "yes", pass fonts through to the PostScript output without |
||||
substitution. Fonts which are embedded in the PDF file will be |
||||
embedded in the PS file. Fonts which are not embedded in the PDF file |
||||
will not be embedded in the PS file, i.e., they are expected to be |
||||
available on the printer. This defaults to "no". |
||||
.TP |
||||
.BR psPreload " yes | no" |
||||
If set to "yes", PDF forms are converted to PS procedures, and image |
||||
data is preloaded. This uses more memory in the PostScript |
||||
interpreter, but generates significantly smaller PS files in |
||||
situations where, e.g., the same image is drawn on every page of a |
||||
long document. This defaults to "no". |
||||
.TP |
||||
.BR psOPI " yes | no" |
||||
If set to "yes", generates PostScript OPI comments for all images and |
||||
forms which have OPI information. This option is only available if |
||||
the Xpdf tools were compiled with OPI support. This defaults to "no". |
||||
.TP |
||||
.BR psASCIIHex " yes | no" |
||||
If set to "yes", the ASCIIHexEncode filter will be used instead of |
||||
ASCII85Encode for binary data. This defaults to "no". |
||||
.TP |
||||
.BR psUncompressPreloadedImages " yes | no" |
||||
If set to "yes", all preloaded images in PS files will uncompressed. |
||||
If set to "no", the original compressed images will be used when |
||||
possible. The "yes" setting is useful to work around certain buggy |
||||
PostScript interpreters. This defaults to "no". |
||||
.TP |
||||
.BR psRasterResolution " float" |
||||
Set the resolution (in dpi) for rasterized pages in PostScript output. |
||||
(Pdftops will rasterize pages which use transparency.) This defaults |
||||
to 300. |
||||
.TP |
||||
.BR psRasterMono " yes | no" |
||||
If set to "yes", rasterized pages in PS files will be monochrome |
||||
(8-bit gray) instead of color. This defaults to "no". |
||||
.TP |
||||
.BI psFile " file\-or\-command" |
||||
Sets the default PostScript file or print command for xpdf. Commands |
||||
start with a \'|' character; anything else is a file. If the file |
||||
name or command contains spaces it must be quoted. This defaults to |
||||
unset, which tells xpdf to generate a name of the form <file>.ps for a |
||||
PDF file <file>.pdf. |
||||
.TP |
||||
.BI fontDir " dir" |
||||
See the description above, in the DISPLAY FONTS section. |
||||
.SH TEXT CONTROL |
||||
.TP |
||||
.BI textEncoding " encoding\-name" |
||||
Sets the encoding to use for text output. (This can be overridden |
||||
with the "-enc" switch on the command line.) The |
||||
.I encoding\-name |
||||
must be defined with the unicodeMap command (see above). This |
||||
defaults to "Latin1". |
||||
.TP |
||||
.BR textEOL " unix | dos | mac" |
||||
Sets the end-of-line convention to use for text output. The options |
||||
are: |
||||
.nf |
||||
|
||||
unix = LF |
||||
dos = CR+LF |
||||
mac = CR |
||||
|
||||
.fi |
||||
(This can be overridden with the "-eol" switch on the command line.) |
||||
The default value is based on the OS where xpdf and pdftotext were |
||||
built. |
||||
.TP |
||||
.BR textPageBreaks " yes | no" |
||||
If set to "yes", text extraction will insert page breaks (form feed |
||||
characters) between pages. This defaults to "yes". |
||||
.TP |
||||
.BR textKeepTinyChars " yes | no" |
||||
If set to "yes", text extraction will keep all characters. If set to |
||||
"no", text extraction will discard tiny (smaller than 3 point) |
||||
characters after the first 50000 per page, avoiding extremely slow run |
||||
times for PDF files that use special fonts to do shading or |
||||
cross-hatching. This defaults to "no". |
||||
.SH MISCELLANEOUS SETTINGS |
||||
.TP |
||||
.BR initialZoom " \fIpercentage\fR | page | width" |
||||
Sets the initial zoom factor. A number specifies a zoom percentage, |
||||
where 100 means 72 dpi. You may also specify \'page', to fit the page |
||||
to the window size, or \'width', to fit the page width to the window |
||||
width. |
||||
.TP |
||||
.BR continuousView " yes | no" |
||||
If set to "yes", xpdf will start in continuous view mode, i.e., with |
||||
one vertical screoll bar for the whole document. This defaults to |
||||
"no". |
||||
.TP |
||||
.BR enableT1lib " yes | no" |
||||
Enables or disables use of t1lib (a Type 1 font rasterizer). This is |
||||
only relevant if the Xpdf tools were built with t1lib support. |
||||
("enableT1lib" replaces the old "t1libControl" option.) This option |
||||
defaults to "yes". |
||||
.TP |
||||
.BR enableFreeType " yes | no" |
||||
Enables or disables use of FreeType (a TrueType / Type 1 font |
||||
rasterizer). This is only relevant if the Xpdf tools were built with |
||||
FreeType support. ("enableFreeType" replaces the old |
||||
"freetypeControl" option.) This option defaults to "yes". |
||||
.TP |
||||
.BR antialias " yes | no" |
||||
Enables or disables font anti-aliasing in the PDF rasterizer. This |
||||
option affects all font rasterizers. ("antialias" replaces the |
||||
anti-aliasing control provided by the old "t1libControl" and |
||||
"freetypeControl" options.) This default to "yes". |
||||
.TP |
||||
.BR vectorAntialias " yes | no" |
||||
Enables or disables anti-aliasing of vector graphics in the PDF |
||||
rasterizer. This defaults to "yes". |
||||
.TP |
||||
.BR strokeAdjust " yes | no" |
||||
Enables or disables stroke adjustment. Stroke adjustment moves |
||||
horizontal and vertical lines by up to half a pixel to make them look |
||||
"cleaner" when vector anti-aliasing is enabled. This defaults to |
||||
"yes". |
||||
.TP |
||||
.BR screenType " dispersed | clustered | stochasticClustered" |
||||
Sets the halftone screen type, which will be used when generating a |
||||
monochrome (1-bit) bitmap. The three options are dispersed-dot |
||||
dithering, clustered-dot dithering (with a round dot and 45-degree |
||||
screen angle), and stochastic clustered-dot dithering. By default, |
||||
"stochasticClustered" is used for resolutions of 300 dpi and higher, |
||||
and "dispersed" is used for resolutions lower then 300 dpi. |
||||
.TP |
||||
.BI screenSize " integer" |
||||
Sets the size of the (square) halftone screen threshold matrix. By |
||||
default, this is 4 for dispersed-dot dithering, 10 for clustered-dot |
||||
dithering, and 100 for stochastic clustered-dot dithering. |
||||
.TP |
||||
.BI screenDotRadius " integer" |
||||
Sets the halftone screen dot radius. This is only used when |
||||
screenType is set to stochasticClustered, and it defaults to 2. In |
||||
clustered-dot mode, the dot radius is half of the screen size. |
||||
Dispersed-dot dithering doesn't have a dot radius. |
||||
.TP |
||||
.BI screenGamma " float" |
||||
Sets the halftone screen gamma correction parameter. Gamma values |
||||
greater than 1 make the output brighter; gamma values less than 1 make |
||||
it darker. The default value is 1. |
||||
.TP |
||||
.BI screenBlackThreshold " float" |
||||
When halftoning, all values below this threshold are forced to solid |
||||
black. This parameter is a floating point value between 0 (black) and |
||||
1 (white). The default value is 0. |
||||
.TP |
||||
.BI screenWhiteThreshold " float" |
||||
When halftoning, all values above this threshold are forced to solid |
||||
white. This parameter is a floating point value between 0 (black) and |
||||
1 (white). The default value is 1. |
||||
.TP |
||||
.BI drawAnnotations " yes | no" |
||||
If set to "no", annotations will not be drawn or printed. The default |
||||
value is "yes". |
||||
.TP |
||||
.BI overprintPreview " yes | no" |
||||
If set to "yes", generate overprint preview output, honoring the |
||||
OP/op/OPM settings in the PDF file. Ignored for non-CMYK output. The |
||||
default value is "no". |
||||
.TP |
||||
.BI launchCommand " command" |
||||
Sets the command executed when you click on a "launch"-type link. The |
||||
intent is for the command to be a program/script which determines the |
||||
file type and runs the appropriate viewer. The command line will |
||||
consist of the file to be launched, followed by any parameters |
||||
specified with the link. Do not use "%s" in "command". By default, |
||||
this is unset, and Xpdf will simply try to execute the file (after |
||||
prompting the user). |
||||
.TP |
||||
.BI urlCommand " command" |
||||
Sets the command executed when you click on a URL link. The string |
||||
"%s" will be replaced with the URL. (See the example below.) This |
||||
has no default value. |
||||
.TP |
||||
.BI movieCommand " command" |
||||
Sets the command executed when you click on a movie annotation. The |
||||
string "%s" will be replaced with the movie file name. This has no |
||||
default value. |
||||
.TP |
||||
.BI mapNumericCharNames " yes | no" |
||||
If set to "yes", the Xpdf tools will attempt to map various numeric |
||||
character names sometimes used in font subsets. In some cases this |
||||
leads to usable text, and in other cases it leads to gibberish -- |
||||
there is no way for Xpdf to tell. This defaults to "yes". |
||||
.TP |
||||
.BI mapUnknownCharNames " yes | no" |
||||
If set to "yes", and mapNumericCharNames is set to "no", the Xpdf |
||||
tools will apply a simple pass-through mapping (Unicode index = |
||||
character code) for all unrecognized glyph names. (For CID fonts, |
||||
setting mapNumericCharNames to "no" is unnecessary.) In some cases, |
||||
this leads to usable text, and in other cases it leads to gibberish -- |
||||
there is no way for Xpdf to tell. This defaults to "no". |
||||
.TP |
||||
.BI bind " modifiers-key context command ..." |
||||
Add a key or mouse button binding. |
||||
.I Modifiers |
||||
can be zero or more of: |
||||
.nf |
||||
|
||||
shift- |
||||
ctrl- |
||||
alt- |
||||
|
||||
.fi |
||||
.I Key |
||||
can be a regular ASCII character, or any one of: |
||||
.nf |
||||
|
||||
space |
||||
tab |
||||
return |
||||
enter |
||||
backspace |
||||
insert |
||||
delete |
||||
home |
||||
end |
||||
pgup |
||||
pgdn |
||||
left / right / up / down (arrow keys) |
||||
f1 .. f35 (function keys) |
||||
mousePress1 .. mousePress7 (mouse buttons) |
||||
mouseRelease1 .. mouseRelease7 (mouse buttons) |
||||
|
||||
.fi |
||||
.I Context |
||||
is either "any" or a comma-separated combination of: |
||||
.nf |
||||
|
||||
fullScreen / window (full screen mode on/off) |
||||
continuous / singlePage (continuous mode on/off) |
||||
overLink / offLink (mouse over link or not) |
||||
scrLockOn / scrLockOff (scroll lock on/off) |
||||
|
||||
.fi |
||||
The context string can include only one of each pair in the above |
||||
list. |
||||
|
||||
.I Command |
||||
is an Xpdf command (see the COMMANDS section of the |
||||
.BR xpdf (1) |
||||
man page for details). Multiple commands are separated by whitespace. |
||||
|
||||
The bind command replaces any existing binding, but only if it was |
||||
defined for the exact same modifiers, key, and context. All tokens |
||||
(modifiers, key, context, commands) are case-sensitive. |
||||
|
||||
Example key bindings: |
||||
.nf |
||||
|
||||
# bind ctrl-a in any context to the nextPage |
||||
# command |
||||
bind ctrl-a any nextPage |
||||
|
||||
# bind uppercase B, when in continuous mode |
||||
# with scroll lock on, to the reload command |
||||
# followed by the prevPage command |
||||
bind B continuous,scrLockOn reload prevPage |
||||
|
||||
.fi |
||||
See the |
||||
.BR xpdf (1) |
||||
man page for more examples. |
||||
.TP |
||||
.BI unbind " modifiers-key context" |
||||
Removes a key binding established with the bind command. This is most |
||||
useful to remove default key bindings before establishing new ones |
||||
(e.g., if the default key binding is given for "any" context, and you |
||||
want to create new key bindings for multiple contexts). |
||||
.TP |
||||
.BI printCommands " yes | no" |
||||
If set to "yes", drawing commands are printed as they're executed |
||||
(useful for debugging). This defaults to "no". |
||||
.TP |
||||
.BI errQuiet " yes | no" |
||||
If set to "yes", this suppresses all error and warning messages from |
||||
all of the Xpdf tools. This defaults to "no". |
||||
.SH EXAMPLES |
||||
The following is a sample xpdfrc file. |
||||
.nf |
||||
|
||||
# from the Thai support package |
||||
nameToUnicode /usr/local/share/xpdf/Thai.nameToUnicode |
||||
|
||||
# from the Japanese support package |
||||
cidToUnicode Adobe-Japan1 /usr/local/share/xpdf/Adobe-Japan1.cidToUnicode |
||||
unicodeMap JISX0208 /usr/local/share/xpdf/JISX0208.unicodeMap |
||||
cMapDir Adobe-Japan1 /usr/local/share/xpdf/cmap/Adobe-Japan1 |
||||
|
||||
# use the Base-14 Type 1 fonts from ghostscript |
||||
displayFontT1 Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb |
||||
displayFontT1 Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb |
||||
displayFontT1 Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb |
||||
displayFontT1 Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb |
||||
displayFontT1 Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb |
||||
displayFontT1 Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb |
||||
displayFontT1 Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb |
||||
displayFontT1 Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb |
||||
displayFontT1 Courier /usr/local/share/ghostscript/fonts/n022003l.pfb |
||||
displayFontT1 Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb |
||||
displayFontT1 Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb |
||||
displayFontT1 Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb |
||||
displayFontT1 Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb |
||||
displayFontT1 ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb |
||||
|
||||
# use the Bakoma Type 1 fonts |
||||
# (this assumes they happen to be installed in /usr/local/fonts/bakoma) |
||||
fontDir /usr/local/fonts/bakoma |
||||
|
||||
# set some PostScript options |
||||
psPaperSize letter |
||||
psDuplex no |
||||
psLevel level2 |
||||
psEmbedType1Fonts yes |
||||
psEmbedTrueTypeFonts yes |
||||
psFile "| lpr -Pprinter5" |
||||
|
||||
# assume that the PostScript printer has the Univers and |
||||
# Univers-Bold fonts |
||||
psFont Univers Univers |
||||
psFont Univers-Bold Univers-Bold |
||||
|
||||
# set the text output options |
||||
textEncoding UTF-8 |
||||
textEOL unix |
||||
|
||||
# misc options |
||||
enableT1lib yes |
||||
enableFreeType yes |
||||
launchCommand viewer-script |
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
|
||||
.fi |
||||
.SH FILES |
||||
.TP |
||||
.B /usr/local/etc/xpdfrc |
||||
This is the default location for the system-wide configuration file. |
||||
Depending on build options, it may be placed elsewhere. |
||||
.TP |
||||
.B $HOME/.xpdfrc |
||||
This is the user's configuration file. If it exists, it will be read |
||||
in place of the system-wide file. |
||||
.SH AUTHOR |
||||
The Xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
.SH "SEE ALSO" |
||||
.BR xpdf (1), |
||||
.BR pdftops (1), |
||||
.BR pdftotext (1), |
||||
.BR pdfinfo (1), |
||||
.BR pdftoppm (1), |
||||
.BR pdfimages (1) |
||||
.br |
||||
.B http://www.foolabs.com/xpdf/ |
@ -1,596 +0,0 @@ |
||||
xpdfrc(5) xpdfrc(5) |
||||
|
||||
|
||||
|
||||
NAME |
||||
xpdfrc - configuration file for Xpdf tools (version 3.02) |
||||
|
||||
DESCRIPTION |
||||
All of the Xpdf tools read a single configuration file. If you have a |
||||
.xpdfrc file in your home directory, it will be read. Otherwise, a |
||||
system-wide configuration file will be read from /usr/local/etc/xpdfrc, |
||||
if it exists. (This is its default location; depending on build |
||||
options, it may be placed elsewhere.) On Win32 systems, the xpdfrc |
||||
file should be placed in the same directory as the executables. |
||||
|
||||
The xpdfrc file consists of a series of configuration options, one per |
||||
line. Blank lines and lines starting with a '#' (comments) are |
||||
ignored. |
||||
|
||||
The following sections list all of the configuration options, sorted |
||||
into functional groups. There is an examples section at the end. |
||||
|
||||
INCLUDE FILES |
||||
include config-file |
||||
Includes the specified config file. The effect of this is |
||||
equivalent to inserting the contents of config-file directly |
||||
into the parent config file in place of the include command. |
||||
Config files can be nested arbitrarily deeply. |
||||
|
||||
CHARACTER MAPPING |
||||
nameToUnicode map-file |
||||
Specifies a file with the mapping from character names to Uni- |
||||
code. This is used to handle PDF fonts that have valid encod- |
||||
ings but no ToUnicode entry. Each line of a nameToUnicode file |
||||
looks like this: |
||||
|
||||
hex-string name |
||||
|
||||
The hex-string is the Unicode (UCS-2) character index, and name |
||||
is the corresponding character name. Multiple nameToUnicode |
||||
files can be used; if a character name is given more than once, |
||||
the code in the last specified file is used. There is a built- |
||||
in default nameToUnicode table with all of Adobe's standard |
||||
character names. |
||||
|
||||
cidToUnicode registry-ordering map-file |
||||
Specifies the file with the mapping from character collection to |
||||
Unicode. Each line of a cidToUnicode file represents one char- |
||||
acter: |
||||
|
||||
hex-string |
||||
|
||||
The hex-string is the Unicode (UCS-2) index for that character. |
||||
The first line maps CID 0, the second line CID 1, etc. File |
||||
size is determined by size of the character collection. Only |
||||
one file is allowed per character collection; the last specified |
||||
file is used. There are no built-in cidToUnicode mappings. |
||||
|
||||
unicodeToUnicode font-name-substring map-file |
||||
This is used to work around PDF fonts which have incorrect Uni- |
||||
code information. It specifies a file which maps from the given |
||||
(incorrect) Unicode indexes to the correct ones. The mapping |
||||
will be used for any font whose name contains font-name-sub- |
||||
string. Each line of a unicodeToUnicode file represents one |
||||
Unicode character: |
||||
|
||||
in-hex out-hex1 out-hex2 ... |
||||
|
||||
The in-hex field is an input (incorrect) Unicode index, and the |
||||
rest of the fields are one or more output (correct) Unicode |
||||
indexes. Each occurrence of in-hex will be converted to the |
||||
specified output sequence. |
||||
|
||||
unicodeMap encoding-name map-file |
||||
Specifies the file with mapping from Unicode to encoding-name. |
||||
These encodings are used for X display fonts and text output |
||||
(see below). Each line of a unicodeMap file represents a range |
||||
of one or more Unicode characters which maps linearly to a range |
||||
in the output encoding: |
||||
|
||||
in-start-hex in-end-hex out-start-hex |
||||
|
||||
Entries for single characters can be abbreviated to: |
||||
|
||||
in-hex out-hex |
||||
|
||||
The in-start-hex and in-end-hex fields (or the single in-hex |
||||
field) specify the Unicode range. The out-start-hex field (or |
||||
the out-hex field) specifies the start of the output encoding |
||||
range. The length of the out-start-hex (or out-hex) string |
||||
determines the length of the output characters (e.g., UTF-8 uses |
||||
different numbers of bytes to represent characters in different |
||||
ranges). Entries must be given in increasing Unicode order. |
||||
Only one file is allowed per encoding; the last specified file |
||||
is used. The Latin1, ASCII7, Symbol, ZapfDingbats, UTF-8, and |
||||
UCS-2 encodings are predefined. |
||||
|
||||
cMapDir registry-ordering dir |
||||
Specifies a search directory, dir, for CMaps for the reg- |
||||
istry-ordering character collection. There can be multiple |
||||
directories for a particular collection. There are no default |
||||
CMap directories. |
||||
|
||||
toUnicodeDir dir |
||||
Specifies a search directory, dir, for ToUnicode CMaps. There |
||||
can be multiple ToUnicode directories. There are no default |
||||
ToUnicode directories. |
||||
|
||||
DISPLAY FONTS |
||||
displayFontT1 PDF-font-name T1-file |
||||
Maps a PDF font, PDF-font-name, to a Type 1 font for display. |
||||
The Type 1 font file, T1-file, should be a standard .pfa or .pfb |
||||
file. |
||||
|
||||
displayFontTT PDF-font-name TT-file |
||||
Maps a PDF font, PDF-font-name, to a TrueType font for display. |
||||
The TrueType font file, TT-file, should be a standard .ttf file. |
||||
|
||||
displayNamedCIDFontT1 PDF-font-name T1-file |
||||
Maps a specific PDF CID (16-bit) font, PDF-font-name, to a CID |
||||
font (16-bit PostScript font), for display. There are no |
||||
default CID font mappings. |
||||
|
||||
displayCIDFontT1 registry-ordering T1-file |
||||
Maps the registry-ordering character collection to a CID font |
||||
(16-bit PostScript font), for display. This mapping is used if |
||||
the font name doesn't match any of the fonts declared with dis- |
||||
playNamedCIDFont* commands. There are no default CID font map- |
||||
pings. |
||||
|
||||
displayNamedCIDFontTT PDF-font-name TT-file |
||||
Maps a specific PDF CID (16-bit) font, PDF-font-name, to a |
||||
(16-bit) TrueType font, for display. There are no default CID |
||||
font mappings. |
||||
|
||||
displayCIDFontTT registry-ordering TT-file |
||||
Maps the registry-ordering character collection to a (16-bit) |
||||
TrueType font, for display. This mapping is used if the font |
||||
name doesn't match any of the fonts declared with displayNamed- |
||||
CIDFont* commands. There are no default CID font mappings. |
||||
|
||||
fontDir dir |
||||
Specifies a search directory for external font files. There can |
||||
be multiple fontDir directories. If a PDF file uses a font but |
||||
doesn't embed it, these directories will be searched for a |
||||
matching font file. These fonts are used by both xpdf (for dis- |
||||
play) and pdftops (for embedding in the generated PostScript). |
||||
Type 1 fonts must have a suffix of ".pfa", ".pfb", ".ps", or no |
||||
suffix at all. TrueType fonts must have a ".ttf" suffix. Other |
||||
files in these directories will be ignored. There are no |
||||
default fontDir directories. |
||||
|
||||
POSTSCRIPT CONTROL |
||||
psPaperSize width(pts) height(pts) |
||||
Sets the paper size for PostScript output. The width and height |
||||
parameters give the paper size in PostScript points (1 point = |
||||
1/72 inch). |
||||
|
||||
psPaperSize letter | legal | A4 | A3 | match |
||||
Sets the paper size for PostScript output to a standard size. |
||||
The default paper size is set when xpdf and pdftops are built, |
||||
typically to "letter" or "A4". This can also be set to "match", |
||||
which will set the paper size to match the size specified in the |
||||
PDF file. |
||||
|
||||
psImageableArea llx lly urx ury |
||||
Sets the imageable area for PostScript output. The four inte- |
||||
gers are the coordinates of the lower-left and upper-right cor- |
||||
ners of the imageable region, specified in points (with the ori- |
||||
gin being the lower-left corner of the paper). This defaults to |
||||
the full paper size; the psPaperSize option will reset the |
||||
imageable area coordinates. |
||||
|
||||
psCrop yes | no |
||||
If set to "yes", PostScript output is cropped to the CropBox |
||||
specified in the PDF file; otherwise no cropping is done. This |
||||
defaults to "yes". |
||||
|
||||
psExpandSmaller yes | no |
||||
If set to "yes", PDF pages smaller than the PostScript imageable |
||||
area are expanded to fill the imageable area. Otherwise, no |
||||
scalling is done on smaller pages. This defaults to "no". |
||||
|
||||
psShrinkLarger yes | no |
||||
If set to yes, PDF pages larger than the PostScript imageable |
||||
area are shrunk to fit the imageable area. Otherwise, no scal- |
||||
ing is done on larger pages. This defaults to "yes". |
||||
|
||||
psCenter yes | no |
||||
If set to yes, PDF pages smaller than the PostScript imageable |
||||
area (after any scaling) are centered in the imageable area. |
||||
Otherwise, they are aligned at the lower-left corner of the |
||||
imageable area. This defaults to "yes". |
||||
|
||||
psDuplex yes | no |
||||
If set to "yes", the generated PostScript will set the "Duplex" |
||||
pagedevice entry. This tells duplex-capable printers to enable |
||||
duplexing. This defaults to "no". |
||||
|
||||
psLevel level1 | level1sep | level2 | level2sep | level3 | level3Sep |
||||
Sets the PostScript level to generate. This defaults to |
||||
"level2". |
||||
|
||||
psFont PDF-font-name PS-font-name |
||||
When the PDF-font-name font is used in a PDF file, it will be |
||||
translated to the PostScript font PS-font-name, which is assumed |
||||
to be resident in the printer. Typically, PDF-font-name and |
||||
PS-font-name are the same. By default, only the Base-14 fonts |
||||
are assumed to be resident. |
||||
|
||||
psNamedFont16 PDF-font-name wMode PS-font-name encoding |
||||
When the 16-bit font PDF-font-name is used in a PDF file with |
||||
the wMode writing mode and is not embedded, the PS-font-name |
||||
font is substituted for it. The writing mode must be either 'H' |
||||
for horizontal or 'V' for vertical. The PS-font-name font is |
||||
assumed to be resident in the printer and to use the specified |
||||
encoding (which must have been defined with the unicodeMap com- |
||||
mand). |
||||
|
||||
psFont16 registry-ordering wMode PS-font-name encoding |
||||
When a 16-bit font using the registry-ordering character collec- |
||||
tion and wMode writing mode is not embedded and does not match |
||||
any of the fonts declared in psNamedFont16 commands, the |
||||
PS-font-name font is substituted for it. The writing mode must |
||||
be either 'H' for horizontal or 'V' for vertical. The |
||||
PS-font-name font is assumed to be resident in the printer and |
||||
to use the specified writing mode and encoding (which must have |
||||
been defined with the unicodeMap command). |
||||
|
||||
psEmbedType1Fonts yes | no |
||||
If set to "no", prevents embedding of Type 1 fonts in generated |
||||
PostScript. This defaults to "yes". |
||||
|
||||
psEmbedTrueTypeFonts yes | no |
||||
If set to "no", prevents embedding of TrueType fonts in gener- |
||||
ated PostScript. This defaults to "yes". |
||||
|
||||
psEmbedCIDTrueTypeFonts yes | no |
||||
If set to "no", prevents embedding of CID TrueType fonts in gen- |
||||
erated PostScript. For Level 3 PostScript, this generates a CID |
||||
font, for lower levels it generates a non-CID composite font. |
||||
|
||||
psEmbedCIDPostScriptFonts yes | no |
||||
If set to "no", prevents embedding of CID PostScript fonts in |
||||
generated PostScript. For Level 3 PostScript, this generates a |
||||
CID font, for lower levels it generates a non-CID composite |
||||
font. |
||||
|
||||
psFontPassthrough yes | no |
||||
If set to "yes", pass fonts through to the PostScript output |
||||
without substitution. Fonts which are embedded in the PDF file |
||||
will be embedded in the PS file. Fonts which are not embedded |
||||
in the PDF file will not be embedded in the PS file, i.e., they |
||||
are expected to be available on the printer. This defaults to |
||||
"no". |
||||
|
||||
psPreload yes | no |
||||
If set to "yes", PDF forms are converted to PS procedures, and |
||||
image data is preloaded. This uses more memory in the Post- |
||||
Script interpreter, but generates significantly smaller PS files |
||||
in situations where, e.g., the same image is drawn on every page |
||||
of a long document. This defaults to "no". |
||||
|
||||
psOPI yes | no |
||||
If set to "yes", generates PostScript OPI comments for all |
||||
images and forms which have OPI information. This option is |
||||
only available if the Xpdf tools were compiled with OPI support. |
||||
This defaults to "no". |
||||
|
||||
psASCIIHex yes | no |
||||
If set to "yes", the ASCIIHexEncode filter will be used instead |
||||
of ASCII85Encode for binary data. This defaults to "no". |
||||
|
||||
psUncompressPreloadedImages yes | no |
||||
If set to "yes", all preloaded images in PS files will uncom- |
||||
pressed. If set to "no", the original compressed images will be |
||||
used when possible. The "yes" setting is useful to work around |
||||
certain buggy PostScript interpreters. This defaults to "no". |
||||
|
||||
psRasterResolution float |
||||
Set the resolution (in dpi) for rasterized pages in PostScript |
||||
output. (Pdftops will rasterize pages which use transparency.) |
||||
This defaults to 300. |
||||
|
||||
psRasterMono yes | no |
||||
If set to "yes", rasterized pages in PS files will be monochrome |
||||
(8-bit gray) instead of color. This defaults to "no". |
||||
|
||||
psFile file-or-command |
||||
Sets the default PostScript file or print command for xpdf. |
||||
Commands start with a '|' character; anything else is a file. |
||||
If the file name or command contains spaces it must be quoted. |
||||
This defaults to unset, which tells xpdf to generate a name of |
||||
the form <file>.ps for a PDF file <file>.pdf. |
||||
|
||||
fontDir dir |
||||
See the description above, in the DISPLAY FONTS section. |
||||
|
||||
TEXT CONTROL |
||||
textEncoding encoding-name |
||||
Sets the encoding to use for text output. (This can be overrid- |
||||
den with the "-enc" switch on the command line.) The encod- |
||||
ing-name must be defined with the unicodeMap command (see |
||||
above). This defaults to "Latin1". |
||||
|
||||
textEOL unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. The |
||||
options are: |
||||
|
||||
unix = LF |
||||
dos = CR+LF |
||||
mac = CR |
||||
|
||||
(This can be overridden with the "-eol" switch on the command |
||||
line.) The default value is based on the OS where xpdf and |
||||
pdftotext were built. |
||||
|
||||
textPageBreaks yes | no |
||||
If set to "yes", text extraction will insert page breaks (form |
||||
feed characters) between pages. This defaults to "yes". |
||||
|
||||
textKeepTinyChars yes | no |
||||
If set to "yes", text extraction will keep all characters. If |
||||
set to "no", text extraction will discard tiny (smaller than 3 |
||||
point) characters after the first 50000 per page, avoiding |
||||
extremely slow run times for PDF files that use special fonts to |
||||
do shading or cross-hatching. This defaults to "no". |
||||
|
||||
MISCELLANEOUS SETTINGS |
||||
initialZoom percentage | page | width |
||||
Sets the initial zoom factor. A number specifies a zoom per- |
||||
centage, where 100 means 72 dpi. You may also specify 'page', |
||||
to fit the page to the window size, or 'width', to fit the page |
||||
width to the window width. |
||||
|
||||
continuousView yes | no |
||||
If set to "yes", xpdf will start in continuous view mode, i.e., |
||||
with one vertical screoll bar for the whole document. This |
||||
defaults to "no". |
||||
|
||||
enableT1lib yes | no |
||||
Enables or disables use of t1lib (a Type 1 font rasterizer). |
||||
This is only relevant if the Xpdf tools were built with t1lib |
||||
support. ("enableT1lib" replaces the old "t1libControl" |
||||
option.) This option defaults to "yes". |
||||
|
||||
enableFreeType yes | no |
||||
Enables or disables use of FreeType (a TrueType / Type 1 font |
||||
rasterizer). This is only relevant if the Xpdf tools were built |
||||
with FreeType support. ("enableFreeType" replaces the old |
||||
"freetypeControl" option.) This option defaults to "yes". |
||||
|
||||
antialias yes | no |
||||
Enables or disables font anti-aliasing in the PDF rasterizer. |
||||
This option affects all font rasterizers. ("antialias" replaces |
||||
the anti-aliasing control provided by the old "t1libControl" and |
||||
"freetypeControl" options.) This default to "yes". |
||||
|
||||
vectorAntialias yes | no |
||||
Enables or disables anti-aliasing of vector graphics in the PDF |
||||
rasterizer. This defaults to "yes". |
||||
|
||||
strokeAdjust yes | no |
||||
Enables or disables stroke adjustment. Stroke adjustment moves |
||||
horizontal and vertical lines by up to half a pixel to make them |
||||
look "cleaner" when vector anti-aliasing is enabled. This |
||||
defaults to "yes". |
||||
|
||||
screenType dispersed | clustered | stochasticClustered |
||||
Sets the halftone screen type, which will be used when generat- |
||||
ing a monochrome (1-bit) bitmap. The three options are dis- |
||||
persed-dot dithering, clustered-dot dithering (with a round dot |
||||
and 45-degree screen angle), and stochastic clustered-dot |
||||
dithering. By default, "stochasticClustered" is used for reso- |
||||
lutions of 300 dpi and higher, and "dispersed" is used for reso- |
||||
lutions lower then 300 dpi. |
||||
|
||||
screenSize integer |
||||
Sets the size of the (square) halftone screen threshold matrix. |
||||
By default, this is 4 for dispersed-dot dithering, 10 for clus- |
||||
tered-dot dithering, and 100 for stochastic clustered-dot |
||||
dithering. |
||||
|
||||
screenDotRadius integer |
||||
Sets the halftone screen dot radius. This is only used when |
||||
screenType is set to stochasticClustered, and it defaults to 2. |
||||
In clustered-dot mode, the dot radius is half of the screen |
||||
size. Dispersed-dot dithering doesn't have a dot radius. |
||||
|
||||
screenGamma float |
||||
Sets the halftone screen gamma correction parameter. Gamma val- |
||||
ues greater than 1 make the output brighter; gamma values less |
||||
than 1 make it darker. The default value is 1. |
||||
|
||||
screenBlackThreshold float |
||||
When halftoning, all values below this threshold are forced to |
||||
solid black. This parameter is a floating point value between 0 |
||||
(black) and 1 (white). The default value is 0. |
||||
|
||||
screenWhiteThreshold float |
||||
When halftoning, all values above this threshold are forced to |
||||
solid white. This parameter is a floating point value between 0 |
||||
(black) and 1 (white). The default value is 1. |
||||
|
||||
drawAnnotations yes | no |
||||
If set to "no", annotations will not be drawn or printed. The |
||||
default value is "yes". |
||||
|
||||
overprintPreview yes | no |
||||
If set to "yes", generate overprint preview output, honoring the |
||||
OP/op/OPM settings in the PDF file. Ignored for non-CMYK out- |
||||
put. The default value is "no". |
||||
|
||||
launchCommand command |
||||
Sets the command executed when you click on a "launch"-type |
||||
link. The intent is for the command to be a program/script |
||||
which determines the file type and runs the appropriate viewer. |
||||
The command line will consist of the file to be launched, fol- |
||||
lowed by any parameters specified with the link. Do not use |
||||
"%s" in "command". By default, this is unset, and Xpdf will |
||||
simply try to execute the file (after prompting the user). |
||||
|
||||
urlCommand command |
||||
Sets the command executed when you click on a URL link. The |
||||
string "%s" will be replaced with the URL. (See the example |
||||
below.) This has no default value. |
||||
|
||||
movieCommand command |
||||
Sets the command executed when you click on a movie annotation. |
||||
The string "%s" will be replaced with the movie file name. This |
||||
has no default value. |
||||
|
||||
mapNumericCharNames yes | no |
||||
If set to "yes", the Xpdf tools will attempt to map various |
||||
numeric character names sometimes used in font subsets. In some |
||||
cases this leads to usable text, and in other cases it leads to |
||||
gibberish -- there is no way for Xpdf to tell. This defaults to |
||||
"yes". |
||||
|
||||
mapUnknownCharNames yes | no |
||||
If set to "yes", and mapNumericCharNames is set to "no", the |
||||
Xpdf tools will apply a simple pass-through mapping (Unicode |
||||
index = character code) for all unrecognized glyph names. (For |
||||
CID fonts, setting mapNumericCharNames to "no" is unnecessary.) |
||||
In some cases, this leads to usable text, and in other cases it |
||||
leads to gibberish -- there is no way for Xpdf to tell. This |
||||
defaults to "no". |
||||
|
||||
bind modifiers-key context command ... |
||||
Add a key or mouse button binding. Modifiers can be zero or |
||||
more of: |
||||
|
||||
shift- |
||||
ctrl- |
||||
alt- |
||||
|
||||
Key can be a regular ASCII character, or any one of: |
||||
|
||||
space |
||||
tab |
||||
return |
||||
enter |
||||
backspace |
||||
insert |
||||
delete |
||||
home |
||||
end |
||||
pgup |
||||
pgdn |
||||
left / right / up / down (arrow keys) |
||||
f1 .. f35 (function keys) |
||||
mousePress1 .. mousePress7 (mouse buttons) |
||||
mouseRelease1 .. mouseRelease7 (mouse buttons) |
||||
|
||||
Context is either "any" or a comma-separated combination of: |
||||
|
||||
fullScreen / window (full screen mode on/off) |
||||
continuous / singlePage (continuous mode on/off) |
||||
overLink / offLink (mouse over link or not) |
||||
scrLockOn / scrLockOff (scroll lock on/off) |
||||
|
||||
The context string can include only one of each pair in the |
||||
above list. |
||||
|
||||
Command is an Xpdf command (see the COMMANDS section of the |
||||
xpdf(1) man page for details). Multiple commands are separated |
||||
by whitespace. |
||||
|
||||
The bind command replaces any existing binding, but only if it |
||||
was defined for the exact same modifiers, key, and context. All |
||||
tokens (modifiers, key, context, commands) are case-sensitive. |
||||
|
||||
Example key bindings: |
||||
|
||||
# bind ctrl-a in any context to the nextPage |
||||
# command |
||||
bind ctrl-a any nextPage |
||||
|
||||
# bind uppercase B, when in continuous mode |
||||
# with scroll lock on, to the reload command |
||||
# followed by the prevPage command |
||||
bind B continuous,scrLockOn reload prevPage |
||||
|
||||
See the xpdf(1) man page for more examples. |
||||
|
||||
unbind modifiers-key context |
||||
Removes a key binding established with the bind command. This |
||||
is most useful to remove default key bindings before establish- |
||||
ing new ones (e.g., if the default key binding is given for |
||||
"any" context, and you want to create new key bindings for mul- |
||||
tiple contexts). |
||||
|
||||
printCommands yes | no |
||||
If set to "yes", drawing commands are printed as they're exe- |
||||
cuted (useful for debugging). This defaults to "no". |
||||
|
||||
errQuiet yes | no |
||||
If set to "yes", this suppresses all error and warning messages |
||||
from all of the Xpdf tools. This defaults to "no". |
||||
|
||||
EXAMPLES |
||||
The following is a sample xpdfrc file. |
||||
|
||||
# from the Thai support package |
||||
nameToUnicode /usr/local/share/xpdf/Thai.nameToUnicode |
||||
|
||||
# from the Japanese support package |
||||
cidToUnicode Adobe-Japan1 /usr/local/share/xpdf/Adobe-Japan1.cidToUnicode |
||||
unicodeMap JISX0208 /usr/local/share/xpdf/JISX0208.unicodeMap |
||||
cMapDir Adobe-Japan1 /usr/local/share/xpdf/cmap/Adobe-Japan1 |
||||
|
||||
# use the Base-14 Type 1 fonts from ghostscript |
||||
displayFontT1 Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb |
||||
displayFontT1 Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb |
||||
displayFontT1 Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb |
||||
displayFontT1 Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb |
||||
displayFontT1 Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb |
||||
displayFontT1 Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb |
||||
displayFontT1 Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb |
||||
displayFontT1 Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb |
||||
displayFontT1 Courier /usr/local/share/ghostscript/fonts/n022003l.pfb |
||||
displayFontT1 Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb |
||||
displayFontT1 Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb |
||||
displayFontT1 Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb |
||||
displayFontT1 Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb |
||||
displayFontT1 ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb |
||||
|
||||
# use the Bakoma Type 1 fonts |
||||
# (this assumes they happen to be installed in /usr/local/fonts/bakoma) |
||||
fontDir /usr/local/fonts/bakoma |
||||
|
||||
# set some PostScript options |
||||
psPaperSize letter |
||||
psDuplex no |
||||
psLevel level2 |
||||
psEmbedType1Fonts yes |
||||
psEmbedTrueTypeFonts yes |
||||
psFile "| lpr -Pprinter5" |
||||
|
||||
# assume that the PostScript printer has the Univers and |
||||
# Univers-Bold fonts |
||||
psFont Univers Univers |
||||
psFont Univers-Bold Univers-Bold |
||||
|
||||
# set the text output options |
||||
textEncoding UTF-8 |
||||
textEOL unix |
||||
|
||||
# misc options |
||||
enableT1lib yes |
||||
enableFreeType yes |
||||
launchCommand viewer-script |
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
|
||||
|
||||
FILES |
||||
/usr/local/etc/xpdfrc |
||||
This is the default location for the system-wide configuration |
||||
file. Depending on build options, it may be placed elsewhere. |
||||
|
||||
$HOME/.xpdfrc |
||||
This is the user's configuration file. If it exists, it will be |
||||
read in place of the system-wide file. |
||||
|
||||
AUTHOR |
||||
The Xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
SEE ALSO |
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdftoppm(1), pdfim- |
||||
ages(1) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
|
||||
|
||||
27 February 2007 xpdfrc(5) |
@ -1,604 +0,0 @@ |
||||
! Generated automatically by mantohlp |
||||
1 xpdfrc |
||||
2 NCLUDE_FILE |
||||
|
||||
xpdfrc - configuration file for Xpdf tools (version 3.02) |
||||
|
||||
include config-file |
||||
Includes the specified config file. The effect of this is |
||||
equivalent to inserting the contents of config-file directly |
||||
into the parent config file in place of the include command. |
||||
Config files can be nested arbitrarily deeply. |
||||
|
||||
() |
||||
|
||||
2 HARACTER_MAPPIN |
||||
|
||||
nameToUnicode map-file |
||||
Specifies a file with the mapping from character names to Uni- |
||||
code. This is used to handle PDF fonts that have valid encod- |
||||
ings but no ToUnicode entry. Each line of a nameToUnicode file |
||||
looks like this: |
||||
|
||||
hex-string name |
||||
|
||||
The hex-string is the Unicode (UCS-2) character index, and name |
||||
is the corresponding character name. Multiple nameToUnicode |
||||
files can be used; if a character name is given more than once, |
||||
the code in the last specified file is used. There is a built- |
||||
in default nameToUnicode table with all of Adobe's standard |
||||
character names. |
||||
|
||||
cidToUnicode registry-ordering map-file |
||||
Specifies the file with the mapping from character collection to |
||||
Unicode. Each line of a cidToUnicode file represents one char- |
||||
acter: |
||||
|
||||
hex-string |
||||
|
||||
The hex-string is the Unicode (UCS-2) index for that character. |
||||
The first line maps CID 0, the second line CID 1, etc. File |
||||
size is determined by size of the character collection. Only |
||||
one file is allowed per character collection; the last specified |
||||
file is used. There are no built-in cidToUnicode mappings. |
||||
|
||||
unicodeToUnicode font-name-substring map-file |
||||
This is used to work around PDF fonts which have incorrect Uni- |
||||
code information. It specifies a file which maps from the given |
||||
(incorrect) Unicode indexes to the correct ones. The mapping |
||||
will be used for any font whose name contains font-name-sub- |
||||
string. Each line of a unicodeToUnicode file represents one |
||||
Unicode character: |
||||
|
||||
in-hex out-hex1 out-hex2 ... |
||||
|
||||
The in-hex field is an input (incorrect) Unicode index, and the |
||||
rest of the fields are one or more output (correct) Unicode |
||||
indexes. Each occurrence of in-hex will be converted to the |
||||
specified output sequence. |
||||
|
||||
unicodeMap encoding-name map-file |
||||
Specifies the file with mapping from Unicode to encoding-name. |
||||
These encodings are used for X display fonts and text output |
||||
(see below). Each line of a unicodeMap file represents a range |
||||
of one or more Unicode characters which maps linearly to a range |
||||
in the output encoding: |
||||
|
||||
in-start-hex in-end-hex out-start-hex |
||||
|
||||
Entries for single characters can be abbreviated to: |
||||
|
||||
in-hex out-hex |
||||
|
||||
The in-start-hex and in-end-hex fields (or the single in-hex |
||||
field) specify the Unicode range. The out-start-hex field (or |
||||
the out-hex field) specifies the start of the output encoding |
||||
range. The length of the out-start-hex (or out-hex) string |
||||
determines the length of the output characters (e.g., UTF-8 uses |
||||
different numbers of bytes to represent characters in different |
||||
ranges). Entries must be given in increasing Unicode order. |
||||
Only one file is allowed per encoding; the last specified file |
||||
is used. The Latin1, ASCII7, Symbol, ZapfDingbats, UTF-8, and |
||||
UCS-2 encodings are predefined. |
||||
|
||||
cMapDir registry-ordering dir |
||||
Specifies a search directory, dir, for CMaps for the reg- |
||||
istry-ordering character collection. There can be multiple |
||||
directories for a particular collection. There are no default |
||||
CMap directories. |
||||
|
||||
toUnicodeDir dir |
||||
Specifies a search directory, dir, for ToUnicode CMaps. There |
||||
can be multiple ToUnicode directories. There are no default |
||||
ToUnicode directories. |
||||
|
||||
() |
||||
|
||||
2 ISPLAY_FONT |
||||
|
||||
displayFontT1 PDF-font-name T1-file |
||||
Maps a PDF font, PDF-font-name, to a Type 1 font for display. |
||||
The Type 1 font file, T1-file, should be a standard .pfa or .pfb |
||||
file. |
||||
|
||||
displayFontTT PDF-font-name TT-file |
||||
Maps a PDF font, PDF-font-name, to a TrueType font for display. |
||||
The TrueType font file, TT-file, should be a standard .ttf file. |
||||
|
||||
displayNamedCIDFontT1 PDF-font-name T1-file |
||||
Maps a specific PDF CID (16-bit) font, PDF-font-name, to a CID |
||||
font (16-bit PostScript font), for display. There are no |
||||
default CID font mappings. |
||||
|
||||
displayCIDFontT1 registry-ordering T1-file |
||||
Maps the registry-ordering character collection to a CID font |
||||
(16-bit PostScript font), for display. This mapping is used if |
||||
the font name doesn't match any of the fonts declared with dis- |
||||
playNamedCIDFont* commands. There are no default CID font map- |
||||
pings. |
||||
|
||||
displayNamedCIDFontTT PDF-font-name TT-file |
||||
Maps a specific PDF CID (16-bit) font, PDF-font-name, to a |
||||
(16-bit) TrueType font, for display. There are no default CID |
||||
font mappings. |
||||
|
||||
displayCIDFontTT registry-ordering TT-file |
||||
Maps the registry-ordering character collection to a (16-bit) |
||||
TrueType font, for display. This mapping is used if the font |
||||
name doesn't match any of the fonts declared with displayNamed- |
||||
CIDFont* commands. There are no default CID font mappings. |
||||
|
||||
fontDir dir |
||||
Specifies a search directory for external font files. There can |
||||
be multiple fontDir directories. If a PDF file uses a font but |
||||
doesn't embed it, these directories will be searched for a |
||||
matching font file. These fonts are used by both xpdf (for dis- |
||||
play) and pdftops (for embedding in the generated PostScript). |
||||
Type 1 fonts must have a suffix of ".pfa", ".pfb", ".ps", or no |
||||
suffix at all. TrueType fonts must have a ".ttf" suffix. Other |
||||
files in these directories will be ignored. There are no |
||||
default fontDir directories. |
||||
|
||||
() |
||||
|
||||
2 OSTSCRIPT_CONTRO |
||||
|
||||
psPaperSize width(pts) height(pts) |
||||
Sets the paper size for PostScript output. The width and height |
||||
parameters give the paper size in PostScript points (1 point = |
||||
1/72 inch). |
||||
|
||||
psPaperSize letter | legal | A4 | A3 | match |
||||
Sets the paper size for PostScript output to a standard size. |
||||
The default paper size is set when xpdf and pdftops are built, |
||||
typically to "letter" or "A4". This can also be set to "match", |
||||
which will set the paper size to match the size specified in the |
||||
PDF file. |
||||
|
||||
psImageableArea llx lly urx ury |
||||
Sets the imageable area for PostScript output. The four inte- |
||||
gers are the coordinates of the lower-left and upper-right cor- |
||||
ners of the imageable region, specified in points (with the ori- |
||||
gin being the lower-left corner of the paper). This defaults to |
||||
the full paper size; the psPaperSize option will reset the |
||||
imageable area coordinates. |
||||
|
||||
psCrop yes | no |
||||
If set to "yes", PostScript output is cropped to the CropBox |
||||
specified in the PDF file; otherwise no cropping is done. This |
||||
defaults to "yes". |
||||
|
||||
psExpandSmaller yes | no |
||||
If set to "yes", PDF pages smaller than the PostScript imageable |
||||
area are expanded to fill the imageable area. Otherwise, no |
||||
scalling is done on smaller pages. This defaults to "no". |
||||
|
||||
psShrinkLarger yes | no |
||||
If set to yes, PDF pages larger than the PostScript imageable |
||||
area are shrunk to fit the imageable area. Otherwise, no scal- |
||||
ing is done on larger pages. This defaults to "yes". |
||||
|
||||
psCenter yes | no |
||||
If set to yes, PDF pages smaller than the PostScript imageable |
||||
area (after any scaling) are centered in the imageable area. |
||||
Otherwise, they are aligned at the lower-left corner of the |
||||
imageable area. This defaults to "yes". |
||||
|
||||
psDuplex yes | no |
||||
If set to "yes", the generated PostScript will set the "Duplex" |
||||
pagedevice entry. This tells duplex-capable printers to enable |
||||
duplexing. This defaults to "no". |
||||
|
||||
psLevel level1 | level1sep | level2 | level2sep | level3 | level3Sep |
||||
Sets the PostScript level to generate. This defaults to |
||||
"level2". |
||||
|
||||
psFont PDF-font-name PS-font-name |
||||
When the PDF-font-name font is used in a PDF file, it will be |
||||
translated to the PostScript font PS-font-name, which is assumed |
||||
to be resident in the printer. Typically, PDF-font-name and |
||||
PS-font-name are the same. By default, only the Base-14 fonts |
||||
are assumed to be resident. |
||||
|
||||
psNamedFont16 PDF-font-name wMode PS-font-name encoding |
||||
When the 16-bit font PDF-font-name is used in a PDF file with |
||||
the wMode writing mode and is not embedded, the PS-font-name |
||||
font is substituted for it. The writing mode must be either 'H' |
||||
for horizontal or 'V' for vertical. The PS-font-name font is |
||||
assumed to be resident in the printer and to use the specified |
||||
encoding (which must have been defined with the unicodeMap com- |
||||
mand). |
||||
|
||||
psFont16 registry-ordering wMode PS-font-name encoding |
||||
When a 16-bit font using the registry-ordering character collec- |
||||
tion and wMode writing mode is not embedded and does not match |
||||
any of the fonts declared in psNamedFont16 commands, the |
||||
PS-font-name font is substituted for it. The writing mode must |
||||
be either 'H' for horizontal or 'V' for vertical. The |
||||
PS-font-name font is assumed to be resident in the printer and |
||||
to use the specified writing mode and encoding (which must have |
||||
been defined with the unicodeMap command). |
||||
|
||||
psEmbedType1Fonts yes | no |
||||
If set to "no", prevents embedding of Type 1 fonts in generated |
||||
PostScript. This defaults to "yes". |
||||
|
||||
psEmbedTrueTypeFonts yes | no |
||||
If set to "no", prevents embedding of TrueType fonts in gener- |
||||
ated PostScript. This defaults to "yes". |
||||
|
||||
psEmbedCIDTrueTypeFonts yes | no |
||||
If set to "no", prevents embedding of CID TrueType fonts in gen- |
||||
erated PostScript. For Level 3 PostScript, this generates a CID |
||||
font, for lower levels it generates a non-CID composite font. |
||||
|
||||
psEmbedCIDPostScriptFonts yes | no |
||||
If set to "no", prevents embedding of CID PostScript fonts in |
||||
generated PostScript. For Level 3 PostScript, this generates a |
||||
CID font, for lower levels it generates a non-CID composite |
||||
font. |
||||
|
||||
psFontPassthrough yes | no |
||||
If set to "yes", pass fonts through to the PostScript output |
||||
without substitution. Fonts which are embedded in the PDF file |
||||
will be embedded in the PS file. Fonts which are not embedded |
||||
in the PDF file will not be embedded in the PS file, i.e., they |
||||
are expected to be available on the printer. This defaults to |
||||
"no". |
||||
|
||||
psPreload yes | no |
||||
If set to "yes", PDF forms are converted to PS procedures, and |
||||
image data is preloaded. This uses more memory in the Post- |
||||
Script interpreter, but generates significantly smaller PS files |
||||
in situations where, e.g., the same image is drawn on every page |
||||
of a long document. This defaults to "no". |
||||
|
||||
psOPI yes | no |
||||
If set to "yes", generates PostScript OPI comments for all |
||||
images and forms which have OPI information. This option is |
||||
only available if the Xpdf tools were compiled with OPI support. |
||||
This defaults to "no". |
||||
|
||||
psASCIIHex yes | no |
||||
If set to "yes", the ASCIIHexEncode filter will be used instead |
||||
of ASCII85Encode for binary data. This defaults to "no". |
||||
|
||||
psUncompressPreloadedImages yes | no |
||||
If set to "yes", all preloaded images in PS files will uncom- |
||||
pressed. If set to "no", the original compressed images will be |
||||
used when possible. The "yes" setting is useful to work around |
||||
certain buggy PostScript interpreters. This defaults to "no". |
||||
|
||||
psRasterResolution float |
||||
Set the resolution (in dpi) for rasterized pages in PostScript |
||||
output. (Pdftops will rasterize pages which use transparency.) |
||||
This defaults to 300. |
||||
|
||||
psRasterMono yes | no |
||||
If set to "yes", rasterized pages in PS files will be monochrome |
||||
(8-bit gray) instead of color. This defaults to "no". |
||||
|
||||
psFile file-or-command |
||||
Sets the default PostScript file or print command for xpdf. |
||||
Commands start with a '|' character; anything else is a file. |
||||
If the file name or command contains spaces it must be quoted. |
||||
This defaults to unset, which tells xpdf to generate a name of |
||||
the form <file>.ps for a PDF file <file>.pdf. |
||||
|
||||
fontDir dir |
||||
See the description above, in the DISPLAY FONTS section. |
||||
|
||||
() |
||||
|
||||
2 EXT_CONTRO |
||||
|
||||
textEncoding encoding-name |
||||
Sets the encoding to use for text output. (This can be overrid- |
||||
den with the "-enc" switch on the command line.) The encod- |
||||
ing-name must be defined with the unicodeMap command (see |
||||
above). This defaults to "Latin1". |
||||
|
||||
textEOL unix | dos | mac |
||||
Sets the end-of-line convention to use for text output. The |
||||
options are: |
||||
|
||||
unix = LF |
||||
dos = CR+LF |
||||
mac = CR |
||||
|
||||
(This can be overridden with the "-eol" switch on the command |
||||
line.) The default value is based on the OS where xpdf and |
||||
pdftotext were built. |
||||
|
||||
textPageBreaks yes | no |
||||
If set to "yes", text extraction will insert page breaks (form |
||||
feed characters) between pages. This defaults to "yes". |
||||
|
||||
textKeepTinyChars yes | no |
||||
If set to "yes", text extraction will keep all characters. If |
||||
set to "no", text extraction will discard tiny (smaller than 3 |
||||
point) characters after the first 50000 per page, avoiding |
||||
extremely slow run times for PDF files that use special fonts to |
||||
do shading or cross-hatching. This defaults to "no". |
||||
|
||||
() |
||||
|
||||
2 ISCELLANEOUS_SETTING |
||||
|
||||
initialZoom percentage | page | width |
||||
Sets the initial zoom factor. A number specifies a zoom per- |
||||
centage, where 100 means 72 dpi. You may also specify 'page', |
||||
to fit the page to the window size, or 'width', to fit the page |
||||
width to the window width. |
||||
|
||||
continuousView yes | no |
||||
If set to "yes", xpdf will start in continuous view mode, i.e., |
||||
with one vertical screoll bar for the whole document. This |
||||
defaults to "no". |
||||
|
||||
enableT1lib yes | no |
||||
Enables or disables use of t1lib (a Type 1 font rasterizer). |
||||
This is only relevant if the Xpdf tools were built with t1lib |
||||
support. ("enableT1lib" replaces the old "t1libControl" |
||||
option.) This option defaults to "yes". |
||||
|
||||
enableFreeType yes | no |
||||
Enables or disables use of FreeType (a TrueType / Type 1 font |
||||
rasterizer). This is only relevant if the Xpdf tools were built |
||||
with FreeType support. ("enableFreeType" replaces the old |
||||
"freetypeControl" option.) This option defaults to "yes". |
||||
|
||||
antialias yes | no |
||||
Enables or disables font anti-aliasing in the PDF rasterizer. |
||||
This option affects all font rasterizers. ("antialias" replaces |
||||
the anti-aliasing control provided by the old "t1libControl" and |
||||
"freetypeControl" options.) This default to "yes". |
||||
|
||||
vectorAntialias yes | no |
||||
Enables or disables anti-aliasing of vector graphics in the PDF |
||||
rasterizer. This defaults to "yes". |
||||
|
||||
strokeAdjust yes | no |
||||
Enables or disables stroke adjustment. Stroke adjustment moves |
||||
horizontal and vertical lines by up to half a pixel to make them |
||||
look "cleaner" when vector anti-aliasing is enabled. This |
||||
defaults to "yes". |
||||
|
||||
screenType dispersed | clustered | stochasticClustered |
||||
Sets the halftone screen type, which will be used when generat- |
||||
ing a monochrome (1-bit) bitmap. The three options are dis- |
||||
persed-dot dithering, clustered-dot dithering (with a round dot |
||||
and 45-degree screen angle), and stochastic clustered-dot |
||||
dithering. By default, "stochasticClustered" is used for reso- |
||||
lutions of 300 dpi and higher, and "dispersed" is used for reso- |
||||
lutions lower then 300 dpi. |
||||
|
||||
screenSize integer |
||||
Sets the size of the (square) halftone screen threshold matrix. |
||||
By default, this is 4 for dispersed-dot dithering, 10 for clus- |
||||
tered-dot dithering, and 100 for stochastic clustered-dot |
||||
dithering. |
||||
|
||||
screenDotRadius integer |
||||
Sets the halftone screen dot radius. This is only used when |
||||
screenType is set to stochasticClustered, and it defaults to 2. |
||||
In clustered-dot mode, the dot radius is half of the screen |
||||
size. Dispersed-dot dithering doesn't have a dot radius. |
||||
|
||||
screenGamma float |
||||
Sets the halftone screen gamma correction parameter. Gamma val- |
||||
ues greater than 1 make the output brighter; gamma values less |
||||
than 1 make it darker. The default value is 1. |
||||
|
||||
screenBlackThreshold float |
||||
When halftoning, all values below this threshold are forced to |
||||
solid black. This parameter is a floating point value between 0 |
||||
(black) and 1 (white). The default value is 0. |
||||
|
||||
screenWhiteThreshold float |
||||
When halftoning, all values above this threshold are forced to |
||||
solid white. This parameter is a floating point value between 0 |
||||
(black) and 1 (white). The default value is 1. |
||||
|
||||
drawAnnotations yes | no |
||||
If set to "no", annotations will not be drawn or printed. The |
||||
default value is "yes". |
||||
|
||||
overprintPreview yes | no |
||||
If set to "yes", generate overprint preview output, honoring the |
||||
OP/op/OPM settings in the PDF file. Ignored for non-CMYK out- |
||||
put. The default value is "no". |
||||
|
||||
launchCommand command |
||||
Sets the command executed when you click on a "launch"-type |
||||
link. The intent is for the command to be a program/script |
||||
which determines the file type and runs the appropriate viewer. |
||||
The command line will consist of the file to be launched, fol- |
||||
lowed by any parameters specified with the link. Do not use |
||||
"%s" in "command". By default, this is unset, and Xpdf will |
||||
simply try to execute the file (after prompting the user). |
||||
|
||||
urlCommand command |
||||
Sets the command executed when you click on a URL link. The |
||||
string "%s" will be replaced with the URL. (See the example |
||||
below.) This has no default value. |
||||
|
||||
movieCommand command |
||||
Sets the command executed when you click on a movie annotation. |
||||
The string "%s" will be replaced with the movie file name. This |
||||
has no default value. |
||||
|
||||
mapNumericCharNames yes | no |
||||
If set to "yes", the Xpdf tools will attempt to map various |
||||
numeric character names sometimes used in font subsets. In some |
||||
cases this leads to usable text, and in other cases it leads to |
||||
gibberish -- there is no way for Xpdf to tell. This defaults to |
||||
"yes". |
||||
|
||||
mapUnknownCharNames yes | no |
||||
If set to "yes", and mapNumericCharNames is set to "no", the |
||||
Xpdf tools will apply a simple pass-through mapping (Unicode |
||||
index = character code) for all unrecognized glyph names. (For |
||||
CID fonts, setting mapNumericCharNames to "no" is unnecessary.) |
||||
In some cases, this leads to usable text, and in other cases it |
||||
leads to gibberish -- there is no way for Xpdf to tell. This |
||||
defaults to "no". |
||||
|
||||
bind modifiers-key context command ... |
||||
Add a key or mouse button binding. Modifiers can be zero or |
||||
more of: |
||||
|
||||
shift- |
||||
ctrl- |
||||
alt- |
||||
|
||||
Key can be a regular ASCII character, or any one of: |
||||
|
||||
space |
||||
tab |
||||
return |
||||
enter |
||||
backspace |
||||
insert |
||||
delete |
||||
home |
||||
end |
||||
pgup |
||||
pgdn |
||||
left / right / up / down (arrow keys) |
||||
f1 .. f35 (function keys) |
||||
mousePress1 .. mousePress7 (mouse buttons) |
||||
mouseRelease1 .. mouseRelease7 (mouse buttons) |
||||
|
||||
Context is either "any" or a comma-separated combination of: |
||||
|
||||
fullScreen / window (full screen mode on/off) |
||||
continuous / singlePage (continuous mode on/off) |
||||
overLink / offLink (mouse over link or not) |
||||
scrLockOn / scrLockOff (scroll lock on/off) |
||||
|
||||
The context string can include only one of each pair in the |
||||
above list. |
||||
|
||||
Command is an Xpdf command (see the COMMANDS section of the |
||||
xpdf(1) man page for details). Multiple commands are separated |
||||
by whitespace. |
||||
|
||||
The bind command replaces any existing binding, but only if it |
||||
was defined for the exact same modifiers, key, and context. All |
||||
tokens (modifiers, key, context, commands) are case-sensitive. |
||||
|
||||
Example key bindings: |
||||
|
||||
# bind ctrl-a in any context to the nextPage |
||||
# command |
||||
bind ctrl-a any nextPage |
||||
|
||||
# bind uppercase B, when in continuous mode |
||||
# with scroll lock on, to the reload command |
||||
# followed by the prevPage command |
||||
bind B continuous,scrLockOn reload prevPage |
||||
|
||||
See the xpdf(1) man page for more examples. |
||||
|
||||
unbind modifiers-key context |
||||
Removes a key binding established with the bind command. This |
||||
is most useful to remove default key bindings before establish- |
||||
ing new ones (e.g., if the default key binding is given for |
||||
"any" context, and you want to create new key bindings for mul- |
||||
tiple contexts). |
||||
|
||||
printCommands yes | no |
||||
If set to "yes", drawing commands are printed as they're exe- |
||||
cuted (useful for debugging). This defaults to "no". |
||||
|
||||
errQuiet yes | no |
||||
If set to "yes", this suppresses all error and warning messages |
||||
from all of the Xpdf tools. This defaults to "no". |
||||
|
||||
() |
||||
|
||||
2 EXAMPLES |
||||
|
||||
The following is a sample xpdfrc file. |
||||
|
||||
# from the Thai support package |
||||
nameToUnicode /usr/local/share/xpdf/Thai.nameToUnicode |
||||
|
||||
# from the Japanese support package |
||||
cidToUnicode Adobe-Japan1 /usr/local/share/xpdf/Adobe-Japan1.cidToUnicode |
||||
unicodeMap JISX0208 /usr/local/share/xpdf/JISX0208.unicodeMap |
||||
cMapDir Adobe-Japan1 /usr/local/share/xpdf/cmap/Adobe-Japan1 |
||||
|
||||
# use the Base-14 Type 1 fonts from ghostscript |
||||
displayFontT1 Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb |
||||
displayFontT1 Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb |
||||
displayFontT1 Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb |
||||
displayFontT1 Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb |
||||
displayFontT1 Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb |
||||
displayFontT1 Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb |
||||
displayFontT1 Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb |
||||
displayFontT1 Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb |
||||
displayFontT1 Courier /usr/local/share/ghostscript/fonts/n022003l.pfb |
||||
displayFontT1 Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb |
||||
displayFontT1 Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb |
||||
displayFontT1 Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb |
||||
displayFontT1 Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb |
||||
displayFontT1 ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb |
||||
|
||||
# use the Bakoma Type 1 fonts |
||||
# (this assumes they happen to be installed in /usr/local/fonts/bakoma) |
||||
fontDir /usr/local/fonts/bakoma |
||||
|
||||
# set some PostScript options |
||||
psPaperSize letter |
||||
psDuplex no |
||||
psLevel level2 |
||||
psEmbedType1Fonts yes |
||||
psEmbedTrueTypeFonts yes |
||||
psFile "| lpr -Pprinter5" |
||||
|
||||
# assume that the PostScript printer has the Univers and |
||||
# Univers-Bold fonts |
||||
psFont Univers Univers |
||||
psFont Univers-Bold Univers-Bold |
||||
|
||||
# set the text output options |
||||
textEncoding UTF-8 |
||||
textEOL unix |
||||
|
||||
# misc options |
||||
enableT1lib yes |
||||
enableFreeType yes |
||||
launchCommand viewer-script |
||||
urlCommand "netscape -remote 'openURL(%s)'" |
||||
|
||||
() |
||||
|
||||
2 FILES |
||||
|
||||
/usr/local/etc/xpdfrc |
||||
This is the default location for the system-wide configuration |
||||
file. Depending on build options, it may be placed elsewhere. |
||||
|
||||
$HOME/.xpdfrc |
||||
This is the user's configuration file. If it exists, it will be |
||||
read in place of the system-wide file. |
||||
|
||||
() |
||||
|
||||
2 AUTHOR |
||||
|
||||
The Xpdf software and documentation are copyright 1996-2007 Glyph & |
||||
Cog, LLC. |
||||
|
||||
() |
||||
|
||||
2 SEE_ALSO |
||||
|
||||
xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdftoppm(1), pdfim- |
||||
ages(1) |
||||
http://www.foolabs.com/xpdf/ |
||||
|
||||
() |
||||
|
@ -1,175 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiBase.cc
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include <limits.h> |
||||
#include "gmem.h" |
||||
#include "FoFiBase.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiBase
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
FoFiBase::FoFiBase(char *fileA, int lenA, GBool freeFileDataA) { |
||||
fileData = file = (Guchar *)fileA; |
||||
len = lenA; |
||||
freeFileData = freeFileDataA; |
||||
} |
||||
|
||||
FoFiBase::~FoFiBase() { |
||||
if (freeFileData) { |
||||
gfree(fileData); |
||||
} |
||||
} |
||||
|
||||
char *FoFiBase::readFile(char *fileName, int *fileLen) { |
||||
FILE *f; |
||||
char *buf; |
||||
int n; |
||||
|
||||
if (!(f = fopen(fileName, "rb"))) { |
||||
return NULL; |
||||
} |
||||
fseek(f, 0, SEEK_END); |
||||
n = (int)ftell(f); |
||||
if (n < 0) { |
||||
fclose(f); |
||||
return NULL; |
||||
} |
||||
fseek(f, 0, SEEK_SET); |
||||
buf = (char *)gmalloc(n); |
||||
if ((int)fread(buf, 1, n, f) != n) { |
||||
gfree(buf); |
||||
fclose(f); |
||||
return NULL; |
||||
} |
||||
fclose(f); |
||||
*fileLen = n; |
||||
return buf; |
||||
} |
||||
|
||||
int FoFiBase::getS8(int pos, GBool *ok) { |
||||
int x; |
||||
|
||||
if (pos < 0 || pos >= len) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos]; |
||||
if (x & 0x80) { |
||||
x |= ~0xff; |
||||
} |
||||
return x; |
||||
} |
||||
|
||||
int FoFiBase::getU8(int pos, GBool *ok) { |
||||
if (pos < 0 || pos >= len) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
return file[pos]; |
||||
} |
||||
|
||||
int FoFiBase::getS16BE(int pos, GBool *ok) { |
||||
int x; |
||||
|
||||
if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos]; |
||||
x = (x << 8) + file[pos+1]; |
||||
if (x & 0x8000) { |
||||
x |= ~0xffff; |
||||
} |
||||
return x; |
||||
} |
||||
|
||||
int FoFiBase::getU16BE(int pos, GBool *ok) { |
||||
int x; |
||||
|
||||
if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos]; |
||||
x = (x << 8) + file[pos+1]; |
||||
return x; |
||||
} |
||||
|
||||
int FoFiBase::getS32BE(int pos, GBool *ok) { |
||||
int x; |
||||
|
||||
if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos]; |
||||
x = (x << 8) + file[pos+1]; |
||||
x = (x << 8) + file[pos+2]; |
||||
x = (x << 8) + file[pos+3]; |
||||
if (x & 0x80000000) { |
||||
x |= ~0xffffffff; |
||||
} |
||||
return x; |
||||
} |
||||
|
||||
Guint FoFiBase::getU32BE(int pos, GBool *ok) { |
||||
Guint x; |
||||
|
||||
if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos]; |
||||
x = (x << 8) + file[pos+1]; |
||||
x = (x << 8) + file[pos+2]; |
||||
x = (x << 8) + file[pos+3]; |
||||
return x; |
||||
} |
||||
|
||||
Guint FoFiBase::getU32LE(int pos, GBool *ok) { |
||||
Guint x; |
||||
|
||||
if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = file[pos+3]; |
||||
x = (x << 8) + file[pos+2]; |
||||
x = (x << 8) + file[pos+1]; |
||||
x = (x << 8) + file[pos]; |
||||
return x; |
||||
} |
||||
|
||||
Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) { |
||||
Guint x; |
||||
int i; |
||||
|
||||
if (pos < 0 || pos + size > len || pos > INT_MAX - size) { |
||||
*ok = gFalse; |
||||
return 0; |
||||
} |
||||
x = 0; |
||||
for (i = 0; i < size; ++i) { |
||||
x = (x << 8) + file[pos + i]; |
||||
} |
||||
return x; |
||||
} |
||||
|
||||
GBool FoFiBase::checkRegion(int pos, int size) { |
||||
return pos >= 0 && |
||||
pos + size >= pos && |
||||
pos + size <= len; |
||||
} |
@ -1,58 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiBase.h
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFIBASE_H |
||||
#define FOFIBASE_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
typedef void (*FoFiOutputFunc)(void *stream, char *data, int len); |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiBase
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FoFiBase { |
||||
public: |
||||
|
||||
virtual ~FoFiBase(); |
||||
|
||||
protected: |
||||
|
||||
FoFiBase(char *fileA, int lenA, GBool freeFileDataA); |
||||
static char *readFile(char *fileName, int *fileLen); |
||||
|
||||
// S = signed / U = unsigned
|
||||
// 8/16/32/Var = word length, in bytes
|
||||
// BE = big endian
|
||||
int getS8(int pos, GBool *ok); |
||||
int getU8(int pos, GBool *ok); |
||||
int getS16BE(int pos, GBool *ok); |
||||
int getU16BE(int pos, GBool *ok); |
||||
int getS32BE(int pos, GBool *ok); |
||||
Guint getU32BE(int pos, GBool *ok); |
||||
Guint getU32LE(int pos, GBool *ok); |
||||
Guint getUVarBE(int pos, int size, GBool *ok); |
||||
|
||||
GBool checkRegion(int pos, int size); |
||||
|
||||
Guchar *fileData; |
||||
Guchar *file; |
||||
int len; |
||||
GBool freeFileData; |
||||
}; |
||||
|
||||
#endif |
@ -1,994 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiEncodings.cc
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdlib.h> |
||||
#include "FoFiEncodings.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Type 1 and 1C font data
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
char *fofiType1StandardEncoding[256] = { |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"space", |
||||
"exclam", |
||||
"quotedbl", |
||||
"numbersign", |
||||
"dollar", |
||||
"percent", |
||||
"ampersand", |
||||
"quoteright", |
||||
"parenleft", |
||||
"parenright", |
||||
"asterisk", |
||||
"plus", |
||||
"comma", |
||||
"hyphen", |
||||
"period", |
||||
"slash", |
||||
"zero", |
||||
"one", |
||||
"two", |
||||
"three", |
||||
"four", |
||||
"five", |
||||
"six", |
||||
"seven", |
||||
"eight", |
||||
"nine", |
||||
"colon", |
||||
"semicolon", |
||||
"less", |
||||
"equal", |
||||
"greater", |
||||
"question", |
||||
"at", |
||||
"A", |
||||
"B", |
||||
"C", |
||||
"D", |
||||
"E", |
||||
"F", |
||||
"G", |
||||
"H", |
||||
"I", |
||||
"J", |
||||
"K", |
||||
"L", |
||||
"M", |
||||
"N", |
||||
"O", |
||||
"P", |
||||
"Q", |
||||
"R", |
||||
"S", |
||||
"T", |
||||
"U", |
||||
"V", |
||||
"W", |
||||
"X", |
||||
"Y", |
||||
"Z", |
||||
"bracketleft", |
||||
"backslash", |
||||
"bracketright", |
||||
"asciicircum", |
||||
"underscore", |
||||
"quoteleft", |
||||
"a", |
||||
"b", |
||||
"c", |
||||
"d", |
||||
"e", |
||||
"f", |
||||
"g", |
||||
"h", |
||||
"i", |
||||
"j", |
||||
"k", |
||||
"l", |
||||
"m", |
||||
"n", |
||||
"o", |
||||
"p", |
||||
"q", |
||||
"r", |
||||
"s", |
||||
"t", |
||||
"u", |
||||
"v", |
||||
"w", |
||||
"x", |
||||
"y", |
||||
"z", |
||||
"braceleft", |
||||
"bar", |
||||
"braceright", |
||||
"asciitilde", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"exclamdown", |
||||
"cent", |
||||
"sterling", |
||||
"fraction", |
||||
"yen", |
||||
"florin", |
||||
"section", |
||||
"currency", |
||||
"quotesingle", |
||||
"quotedblleft", |
||||
"guillemotleft", |
||||
"guilsinglleft", |
||||
"guilsinglright", |
||||
"fi", |
||||
"fl", |
||||
NULL, |
||||
"endash", |
||||
"dagger", |
||||
"daggerdbl", |
||||
"periodcentered", |
||||
NULL, |
||||
"paragraph", |
||||
"bullet", |
||||
"quotesinglbase", |
||||
"quotedblbase", |
||||
"quotedblright", |
||||
"guillemotright", |
||||
"ellipsis", |
||||
"perthousand", |
||||
NULL, |
||||
"questiondown", |
||||
NULL, |
||||
"grave", |
||||
"acute", |
||||
"circumflex", |
||||
"tilde", |
||||
"macron", |
||||
"breve", |
||||
"dotaccent", |
||||
"dieresis", |
||||
NULL, |
||||
"ring", |
||||
"cedilla", |
||||
NULL, |
||||
"hungarumlaut", |
||||
"ogonek", |
||||
"caron", |
||||
"emdash", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"AE", |
||||
NULL, |
||||
"ordfeminine", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"Lslash", |
||||
"Oslash", |
||||
"OE", |
||||
"ordmasculine", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"ae", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"dotlessi", |
||||
NULL, |
||||
NULL, |
||||
"lslash", |
||||
"oslash", |
||||
"oe", |
||||
"germandbls", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL |
||||
}; |
||||
|
||||
char *fofiType1ExpertEncoding[256] = { |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"space", |
||||
"exclamsmall", |
||||
"Hungarumlautsmall", |
||||
NULL, |
||||
"dollaroldstyle", |
||||
"dollarsuperior", |
||||
"ampersandsmall", |
||||
"Acutesmall", |
||||
"parenleftsuperior", |
||||
"parenrightsuperior", |
||||
"twodotenleader", |
||||
"onedotenleader", |
||||
"comma", |
||||
"hyphen", |
||||
"period", |
||||
"fraction", |
||||
"zerooldstyle", |
||||
"oneoldstyle", |
||||
"twooldstyle", |
||||
"threeoldstyle", |
||||
"fouroldstyle", |
||||
"fiveoldstyle", |
||||
"sixoldstyle", |
||||
"sevenoldstyle", |
||||
"eightoldstyle", |
||||
"nineoldstyle", |
||||
"colon", |
||||
"semicolon", |
||||
"commasuperior", |
||||
"threequartersemdash", |
||||
"periodsuperior", |
||||
"questionsmall", |
||||
NULL, |
||||
"asuperior", |
||||
"bsuperior", |
||||
"centsuperior", |
||||
"dsuperior", |
||||
"esuperior", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"isuperior", |
||||
NULL, |
||||
NULL, |
||||
"lsuperior", |
||||
"msuperior", |
||||
"nsuperior", |
||||
"osuperior", |
||||
NULL, |
||||
NULL, |
||||
"rsuperior", |
||||
"ssuperior", |
||||
"tsuperior", |
||||
NULL, |
||||
"ff", |
||||
"fi", |
||||
"fl", |
||||
"ffi", |
||||
"ffl", |
||||
"parenleftinferior", |
||||
NULL, |
||||
"parenrightinferior", |
||||
"Circumflexsmall", |
||||
"hyphensuperior", |
||||
"Gravesmall", |
||||
"Asmall", |
||||
"Bsmall", |
||||
"Csmall", |
||||
"Dsmall", |
||||
"Esmall", |
||||
"Fsmall", |
||||
"Gsmall", |
||||
"Hsmall", |
||||
"Ismall", |
||||
"Jsmall", |
||||
"Ksmall", |
||||
"Lsmall", |
||||
"Msmall", |
||||
"Nsmall", |
||||
"Osmall", |
||||
"Psmall", |
||||
"Qsmall", |
||||
"Rsmall", |
||||
"Ssmall", |
||||
"Tsmall", |
||||
"Usmall", |
||||
"Vsmall", |
||||
"Wsmall", |
||||
"Xsmall", |
||||
"Ysmall", |
||||
"Zsmall", |
||||
"colonmonetary", |
||||
"onefitted", |
||||
"rupiah", |
||||
"Tildesmall", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"exclamdownsmall", |
||||
"centoldstyle", |
||||
"Lslashsmall", |
||||
NULL, |
||||
NULL, |
||||
"Scaronsmall", |
||||
"Zcaronsmall", |
||||
"Dieresissmall", |
||||
"Brevesmall", |
||||
"Caronsmall", |
||||
NULL, |
||||
"Dotaccentsmall", |
||||
NULL, |
||||
NULL, |
||||
"Macronsmall", |
||||
NULL, |
||||
NULL, |
||||
"figuredash", |
||||
"hypheninferior", |
||||
NULL, |
||||
NULL, |
||||
"Ogoneksmall", |
||||
"Ringsmall", |
||||
"Cedillasmall", |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
"onequarter", |
||||
"onehalf", |
||||
"threequarters", |
||||
"questiondownsmall", |
||||
"oneeighth", |
||||
"threeeighths", |
||||
"fiveeighths", |
||||
"seveneighths", |
||||
"onethird", |
||||
"twothirds", |
||||
NULL, |
||||
NULL, |
||||
"zerosuperior", |
||||
"onesuperior", |
||||
"twosuperior", |
||||
"threesuperior", |
||||
"foursuperior", |
||||
"fivesuperior", |
||||
"sixsuperior", |
||||
"sevensuperior", |
||||
"eightsuperior", |
||||
"ninesuperior", |
||||
"zeroinferior", |
||||
"oneinferior", |
||||
"twoinferior", |
||||
"threeinferior", |
||||
"fourinferior", |
||||
"fiveinferior", |
||||
"sixinferior", |
||||
"seveninferior", |
||||
"eightinferior", |
||||
"nineinferior", |
||||
"centinferior", |
||||
"dollarinferior", |
||||
"periodinferior", |
||||
"commainferior", |
||||
"Agravesmall", |
||||
"Aacutesmall", |
||||
"Acircumflexsmall", |
||||
"Atildesmall", |
||||
"Adieresissmall", |
||||
"Aringsmall", |
||||
"AEsmall", |
||||
"Ccedillasmall", |
||||
"Egravesmall", |
||||
"Eacutesmall", |
||||
"Ecircumflexsmall", |
||||
"Edieresissmall", |
||||
"Igravesmall", |
||||
"Iacutesmall", |
||||
"Icircumflexsmall", |
||||
"Idieresissmall", |
||||
"Ethsmall", |
||||
"Ntildesmall", |
||||
"Ogravesmall", |
||||
"Oacutesmall", |
||||
"Ocircumflexsmall", |
||||
"Otildesmall", |
||||
"Odieresissmall", |
||||
"OEsmall", |
||||
"Oslashsmall", |
||||
"Ugravesmall", |
||||
"Uacutesmall", |
||||
"Ucircumflexsmall", |
||||
"Udieresissmall", |
||||
"Yacutesmall", |
||||
"Thornsmall", |
||||
"Ydieresissmall" |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Type 1C font data
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
char *fofiType1CStdStrings[391] = { |
||||
".notdef", |
||||
"space", |
||||
"exclam", |
||||
"quotedbl", |
||||
"numbersign", |
||||
"dollar", |
||||
"percent", |
||||
"ampersand", |
||||
"quoteright", |
||||
"parenleft", |
||||
"parenright", |
||||
"asterisk", |
||||
"plus", |
||||
"comma", |
||||
"hyphen", |
||||
"period", |
||||
"slash", |
||||
"zero", |
||||
"one", |
||||
"two", |
||||
"three", |
||||
"four", |
||||
"five", |
||||
"six", |
||||
"seven", |
||||
"eight", |
||||
"nine", |
||||
"colon", |
||||
"semicolon", |
||||
"less", |
||||
"equal", |
||||
"greater", |
||||
"question", |
||||
"at", |
||||
"A", |
||||
"B", |
||||
"C", |
||||
"D", |
||||
"E", |
||||
"F", |
||||
"G", |
||||
"H", |
||||
"I", |
||||
"J", |
||||
"K", |
||||
"L", |
||||
"M", |
||||
"N", |
||||
"O", |
||||
"P", |
||||
"Q", |
||||
"R", |
||||
"S", |
||||
"T", |
||||
"U", |
||||
"V", |
||||
"W", |
||||
"X", |
||||
"Y", |
||||
"Z", |
||||
"bracketleft", |
||||
"backslash", |
||||
"bracketright", |
||||
"asciicircum", |
||||
"underscore", |
||||
"quoteleft", |
||||
"a", |
||||
"b", |
||||
"c", |
||||
"d", |
||||
"e", |
||||
"f", |
||||
"g", |
||||
"h", |
||||
"i", |
||||
"j", |
||||
"k", |
||||
"l", |
||||
"m", |
||||
"n", |
||||
"o", |
||||
"p", |
||||
"q", |
||||
"r", |
||||
"s", |
||||
"t", |
||||
"u", |
||||
"v", |
||||
"w", |
||||
"x", |
||||
"y", |
||||
"z", |
||||
"braceleft", |
||||
"bar", |
||||
"braceright", |
||||
"asciitilde", |
||||
"exclamdown", |
||||
"cent", |
||||
"sterling", |
||||
"fraction", |
||||
"yen", |
||||
"florin", |
||||
"section", |
||||
"currency", |
||||
"quotesingle", |
||||
"quotedblleft", |
||||
"guillemotleft", |
||||
"guilsinglleft", |
||||
"guilsinglright", |
||||
"fi", |
||||
"fl", |
||||
"endash", |
||||
"dagger", |
||||
"daggerdbl", |
||||
"periodcentered", |
||||
"paragraph", |
||||
"bullet", |
||||
"quotesinglbase", |
||||
"quotedblbase", |
||||
"quotedblright", |
||||
"guillemotright", |
||||
"ellipsis", |
||||
"perthousand", |
||||
"questiondown", |
||||
"grave", |
||||
"acute", |
||||
"circumflex", |
||||
"tilde", |
||||
"macron", |
||||
"breve", |
||||
"dotaccent", |
||||
"dieresis", |
||||
"ring", |
||||
"cedilla", |
||||
"hungarumlaut", |
||||
"ogonek", |
||||
"caron", |
||||
"emdash", |
||||
"AE", |
||||
"ordfeminine", |
||||
"Lslash", |
||||
"Oslash", |
||||
"OE", |
||||
"ordmasculine", |
||||
"ae", |
||||
"dotlessi", |
||||
"lslash", |
||||
"oslash", |
||||
"oe", |
||||
"germandbls", |
||||
"onesuperior", |
||||
"logicalnot", |
||||
"mu", |
||||
"trademark", |
||||
"Eth", |
||||
"onehalf", |
||||
"plusminus", |
||||
"Thorn", |
||||
"onequarter", |
||||
"divide", |
||||
"brokenbar", |
||||
"degree", |
||||
"thorn", |
||||
"threequarters", |
||||
"twosuperior", |
||||
"registered", |
||||
"minus", |
||||
"eth", |
||||
"multiply", |
||||
"threesuperior", |
||||
"copyright", |
||||
"Aacute", |
||||
"Acircumflex", |
||||
"Adieresis", |
||||
"Agrave", |
||||
"Aring", |
||||
"Atilde", |
||||
"Ccedilla", |
||||
"Eacute", |
||||
"Ecircumflex", |
||||
"Edieresis", |
||||
"Egrave", |
||||
"Iacute", |
||||
"Icircumflex", |
||||
"Idieresis", |
||||
"Igrave", |
||||
"Ntilde", |
||||
"Oacute", |
||||
"Ocircumflex", |
||||
"Odieresis", |
||||
"Ograve", |
||||
"Otilde", |
||||
"Scaron", |
||||
"Uacute", |
||||
"Ucircumflex", |
||||
"Udieresis", |
||||
"Ugrave", |
||||
"Yacute", |
||||
"Ydieresis", |
||||
"Zcaron", |
||||
"aacute", |
||||
"acircumflex", |
||||
"adieresis", |
||||
"agrave", |
||||
"aring", |
||||
"atilde", |
||||
"ccedilla", |
||||
"eacute", |
||||
"ecircumflex", |
||||
"edieresis", |
||||
"egrave", |
||||
"iacute", |
||||
"icircumflex", |
||||
"idieresis", |
||||
"igrave", |
||||
"ntilde", |
||||
"oacute", |
||||
"ocircumflex", |
||||
"odieresis", |
||||
"ograve", |
||||
"otilde", |
||||
"scaron", |
||||
"uacute", |
||||
"ucircumflex", |
||||
"udieresis", |
||||
"ugrave", |
||||
"yacute", |
||||
"ydieresis", |
||||
"zcaron", |
||||
"exclamsmall", |
||||
"Hungarumlautsmall", |
||||
"dollaroldstyle", |
||||
"dollarsuperior", |
||||
"ampersandsmall", |
||||
"Acutesmall", |
||||
"parenleftsuperior", |
||||
"parenrightsuperior", |
||||
"twodotenleader", |
||||
"onedotenleader", |
||||
"zerooldstyle", |
||||
"oneoldstyle", |
||||
"twooldstyle", |
||||
"threeoldstyle", |
||||
"fouroldstyle", |
||||
"fiveoldstyle", |
||||
"sixoldstyle", |
||||
"sevenoldstyle", |
||||
"eightoldstyle", |
||||
"nineoldstyle", |
||||
"commasuperior", |
||||
"threequartersemdash", |
||||
"periodsuperior", |
||||
"questionsmall", |
||||
"asuperior", |
||||
"bsuperior", |
||||
"centsuperior", |
||||
"dsuperior", |
||||
"esuperior", |
||||
"isuperior", |
||||
"lsuperior", |
||||
"msuperior", |
||||
"nsuperior", |
||||
"osuperior", |
||||
"rsuperior", |
||||
"ssuperior", |
||||
"tsuperior", |
||||
"ff", |
||||
"ffi", |
||||
"ffl", |
||||
"parenleftinferior", |
||||
"parenrightinferior", |
||||
"Circumflexsmall", |
||||
"hyphensuperior", |
||||
"Gravesmall", |
||||
"Asmall", |
||||
"Bsmall", |
||||
"Csmall", |
||||
"Dsmall", |
||||
"Esmall", |
||||
"Fsmall", |
||||
"Gsmall", |
||||
"Hsmall", |
||||
"Ismall", |
||||
"Jsmall", |
||||
"Ksmall", |
||||
"Lsmall", |
||||
"Msmall", |
||||
"Nsmall", |
||||
"Osmall", |
||||
"Psmall", |
||||
"Qsmall", |
||||
"Rsmall", |
||||
"Ssmall", |
||||
"Tsmall", |
||||
"Usmall", |
||||
"Vsmall", |
||||
"Wsmall", |
||||
"Xsmall", |
||||
"Ysmall", |
||||
"Zsmall", |
||||
"colonmonetary", |
||||
"onefitted", |
||||
"rupiah", |
||||
"Tildesmall", |
||||
"exclamdownsmall", |
||||
"centoldstyle", |
||||
"Lslashsmall", |
||||
"Scaronsmall", |
||||
"Zcaronsmall", |
||||
"Dieresissmall", |
||||
"Brevesmall", |
||||
"Caronsmall", |
||||
"Dotaccentsmall", |
||||
"Macronsmall", |
||||
"figuredash", |
||||
"hypheninferior", |
||||
"Ogoneksmall", |
||||
"Ringsmall", |
||||
"Cedillasmall", |
||||
"questiondownsmall", |
||||
"oneeighth", |
||||
"threeeighths", |
||||
"fiveeighths", |
||||
"seveneighths", |
||||
"onethird", |
||||
"twothirds", |
||||
"zerosuperior", |
||||
"foursuperior", |
||||
"fivesuperior", |
||||
"sixsuperior", |
||||
"sevensuperior", |
||||
"eightsuperior", |
||||
"ninesuperior", |
||||
"zeroinferior", |
||||
"oneinferior", |
||||
"twoinferior", |
||||
"threeinferior", |
||||
"fourinferior", |
||||
"fiveinferior", |
||||
"sixinferior", |
||||
"seveninferior", |
||||
"eightinferior", |
||||
"nineinferior", |
||||
"centinferior", |
||||
"dollarinferior", |
||||
"periodinferior", |
||||
"commainferior", |
||||
"Agravesmall", |
||||
"Aacutesmall", |
||||
"Acircumflexsmall", |
||||
"Atildesmall", |
||||
"Adieresissmall", |
||||
"Aringsmall", |
||||
"AEsmall", |
||||
"Ccedillasmall", |
||||
"Egravesmall", |
||||
"Eacutesmall", |
||||
"Ecircumflexsmall", |
||||
"Edieresissmall", |
||||
"Igravesmall", |
||||
"Iacutesmall", |
||||
"Icircumflexsmall", |
||||
"Idieresissmall", |
||||
"Ethsmall", |
||||
"Ntildesmall", |
||||
"Ogravesmall", |
||||
"Oacutesmall", |
||||
"Ocircumflexsmall", |
||||
"Otildesmall", |
||||
"Odieresissmall", |
||||
"OEsmall", |
||||
"Oslashsmall", |
||||
"Ugravesmall", |
||||
"Uacutesmall", |
||||
"Ucircumflexsmall", |
||||
"Udieresissmall", |
||||
"Yacutesmall", |
||||
"Thornsmall", |
||||
"Ydieresissmall", |
||||
"001.000", |
||||
"001.001", |
||||
"001.002", |
||||
"001.003", |
||||
"Black", |
||||
"Bold", |
||||
"Book", |
||||
"Light", |
||||
"Medium", |
||||
"Regular", |
||||
"Roman", |
||||
"Semibold" |
||||
}; |
||||
|
||||
Gushort fofiType1CISOAdobeCharset[229] = { |
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, |
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, |
||||
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, |
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, |
||||
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
||||
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, |
||||
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
||||
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
||||
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, |
||||
130, 131, 132, 133, 134, 135, 136, 137, 138, 139, |
||||
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
||||
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, |
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, |
||||
170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
||||
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, |
||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
||||
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, |
||||
220, 221, 222, 223, 224, 225, 226, 227, 228 |
||||
}; |
||||
|
||||
Gushort fofiType1CExpertCharset[166] = { |
||||
0, 1, 229, 230, 231, 232, 233, 234, 235, 236, |
||||
237, 238, 13, 14, 15, 99, 239, 240, 241, 242, |
||||
243, 244, 245, 246, 247, 248, 27, 28, 249, 250, |
||||
251, 252, 253, 254, 255, 256, 257, 258, 259, 260, |
||||
261, 262, 263, 264, 265, 266, 109, 110, 267, 268, |
||||
269, 270, 271, 272, 273, 274, 275, 276, 277, 278, |
||||
279, 280, 281, 282, 283, 284, 285, 286, 287, 288, |
||||
289, 290, 291, 292, 293, 294, 295, 296, 297, 298, |
||||
299, 300, 301, 302, 303, 304, 305, 306, 307, 308, |
||||
309, 310, 311, 312, 313, 314, 315, 316, 317, 318, |
||||
158, 155, 163, 319, 320, 321, 322, 323, 324, 325, |
||||
326, 150, 164, 169, 327, 328, 329, 330, 331, 332, |
||||
333, 334, 335, 336, 337, 338, 339, 340, 341, 342, |
||||
343, 344, 345, 346, 347, 348, 349, 350, 351, 352, |
||||
353, 354, 355, 356, 357, 358, 359, 360, 361, 362, |
||||
363, 364, 365, 366, 367, 368, 369, 370, 371, 372, |
||||
373, 374, 375, 376, 377, 378 |
||||
}; |
||||
|
||||
Gushort fofiType1CExpertSubsetCharset[87] = { |
||||
0, 1, 231, 232, 235, 236, 237, 238, 13, 14, |
||||
15, 99, 239, 240, 241, 242, 243, 244, 245, 246, |
||||
247, 248, 27, 28, 249, 250, 251, 253, 254, 255, |
||||
256, 257, 258, 259, 260, 261, 262, 263, 264, 265, |
||||
266, 109, 110, 267, 268, 269, 270, 272, 300, 301, |
||||
302, 305, 314, 315, 158, 155, 163, 320, 321, 322, |
||||
323, 324, 325, 326, 150, 164, 169, 327, 328, 329, |
||||
330, 331, 332, 333, 334, 335, 336, 337, 338, 339, |
||||
340, 341, 342, 343, 344, 345, 346 |
||||
}; |
@ -1,36 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiEncodings.h
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFIENCODINGS_H |
||||
#define FOFIENCODINGS_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Type 1 and 1C font data
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
extern char *fofiType1StandardEncoding[256]; |
||||
extern char *fofiType1ExpertEncoding[256]; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Type 1C font data
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
extern char *fofiType1CStdStrings[391]; |
||||
extern Gushort fofiType1CISOAdobeCharset[229]; |
||||
extern Gushort fofiType1CExpertCharset[166]; |
||||
extern Gushort fofiType1CExpertSubsetCharset[87]; |
||||
|
||||
#endif |
@ -1,632 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiIdentifier.cc
|
||||
//
|
||||
// Copyright 2009 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include <limits.h> |
||||
#include "gtypes.h" |
||||
#include "FoFiIdentifier.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class Reader { |
||||
public: |
||||
|
||||
virtual ~Reader() {} |
||||
|
||||
// Read one byte. Returns -1 if past EOF.
|
||||
virtual int getByte(int pos) = 0; |
||||
|
||||
// Read a big-endian unsigned 16-bit integer. Fills in *val and
|
||||
// returns true if successful.
|
||||
virtual GBool getU16BE(int pos, int *val) = 0; |
||||
|
||||
// Read a big-endian unsigned 32-bit integer. Fills in *val and
|
||||
// returns true if successful.
|
||||
virtual GBool getU32BE(int pos, Guint *val) = 0; |
||||
|
||||
// Read a little-endian unsigned 32-bit integer. Fills in *val and
|
||||
// returns true if successful.
|
||||
virtual GBool getU32LE(int pos, Guint *val) = 0; |
||||
|
||||
// Read a big-endian unsigned <size>-byte integer, where 1 <= size
|
||||
// <= 4. Fills in *val and returns true if successful.
|
||||
virtual GBool getUVarBE(int pos, int size, Guint *val) = 0; |
||||
|
||||
// Compare against a string. Returns true if equal.
|
||||
virtual GBool cmp(int pos, char *s) = 0; |
||||
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class MemReader: public Reader { |
||||
public: |
||||
|
||||
static MemReader *make(char *bufA, int lenA); |
||||
virtual ~MemReader(); |
||||
virtual int getByte(int pos); |
||||
virtual GBool getU16BE(int pos, int *val); |
||||
virtual GBool getU32BE(int pos, Guint *val); |
||||
virtual GBool getU32LE(int pos, Guint *val); |
||||
virtual GBool getUVarBE(int pos, int size, Guint *val); |
||||
virtual GBool cmp(int pos, char *s); |
||||
|
||||
private: |
||||
|
||||
MemReader(char *bufA, int lenA); |
||||
|
||||
char *buf; |
||||
int len; |
||||
}; |
||||
|
||||
MemReader *MemReader::make(char *bufA, int lenA) { |
||||
return new MemReader(bufA, lenA); |
||||
} |
||||
|
||||
MemReader::MemReader(char *bufA, int lenA) { |
||||
buf = bufA; |
||||
len = lenA; |
||||
} |
||||
|
||||
MemReader::~MemReader() { |
||||
} |
||||
|
||||
int MemReader::getByte(int pos) { |
||||
if (pos < 0 || pos >= len) { |
||||
return -1; |
||||
} |
||||
return buf[pos] & 0xff; |
||||
} |
||||
|
||||
GBool MemReader::getU16BE(int pos, int *val) { |
||||
if (pos < 0 || pos > len - 2) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos] & 0xff) << 8) + |
||||
(buf[pos+1] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool MemReader::getU32BE(int pos, Guint *val) { |
||||
if (pos < 0 || pos > len - 4) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos] & 0xff) << 24) + |
||||
((buf[pos+1] & 0xff) << 16) + |
||||
((buf[pos+2] & 0xff) << 8) + |
||||
(buf[pos+3] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool MemReader::getU32LE(int pos, Guint *val) { |
||||
if (pos < 0 || pos > len - 4) { |
||||
return gFalse; |
||||
} |
||||
*val = (buf[pos] & 0xff) + |
||||
((buf[pos+1] & 0xff) << 8) + |
||||
((buf[pos+2] & 0xff) << 16) + |
||||
((buf[pos+3] & 0xff) << 24); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool MemReader::getUVarBE(int pos, int size, Guint *val) { |
||||
int i; |
||||
|
||||
if (size < 1 || size > 4 || pos < 0 || pos > len - size) { |
||||
return gFalse; |
||||
} |
||||
*val = 0; |
||||
for (i = 0; i < size; ++i) { |
||||
*val = (*val << 8) + (buf[pos + i] & 0xff); |
||||
} |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool MemReader::cmp(int pos, char *s) { |
||||
int n; |
||||
|
||||
n = strlen(s); |
||||
if (pos < 0 || len < n || pos > len - n) { |
||||
return gFalse; |
||||
} |
||||
return !memcmp(buf + pos, s, n); |
||||
} |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FileReader: public Reader { |
||||
public: |
||||
|
||||
static FileReader *make(char *fileName); |
||||
virtual ~FileReader(); |
||||
virtual int getByte(int pos); |
||||
virtual GBool getU16BE(int pos, int *val); |
||||
virtual GBool getU32BE(int pos, Guint *val); |
||||
virtual GBool getU32LE(int pos, Guint *val); |
||||
virtual GBool getUVarBE(int pos, int size, Guint *val); |
||||
virtual GBool cmp(int pos, char *s); |
||||
|
||||
private: |
||||
|
||||
FileReader(FILE *fA); |
||||
GBool fillBuf(int pos, int len); |
||||
|
||||
FILE *f; |
||||
char buf[1024]; |
||||
int bufPos, bufLen; |
||||
}; |
||||
|
||||
FileReader *FileReader::make(char *fileName) { |
||||
FILE *fA; |
||||
|
||||
if (!(fA = fopen(fileName, "rb"))) { |
||||
return NULL; |
||||
} |
||||
return new FileReader(fA); |
||||
} |
||||
|
||||
FileReader::FileReader(FILE *fA) { |
||||
f = fA; |
||||
bufPos = 0; |
||||
bufLen = 0; |
||||
} |
||||
|
||||
FileReader::~FileReader() { |
||||
fclose(f); |
||||
} |
||||
|
||||
int FileReader::getByte(int pos) { |
||||
if (!fillBuf(pos, 1)) { |
||||
return -1; |
||||
} |
||||
return buf[pos - bufPos] & 0xff; |
||||
} |
||||
|
||||
GBool FileReader::getU16BE(int pos, int *val) { |
||||
if (!fillBuf(pos, 2)) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos - bufPos] & 0xff) << 8) + |
||||
(buf[pos - bufPos + 1] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool FileReader::getU32BE(int pos, Guint *val) { |
||||
if (!fillBuf(pos, 4)) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos - bufPos] & 0xff) << 24) + |
||||
((buf[pos - bufPos + 1] & 0xff) << 16) + |
||||
((buf[pos - bufPos + 2] & 0xff) << 8) + |
||||
(buf[pos - bufPos + 3] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool FileReader::getU32LE(int pos, Guint *val) { |
||||
if (!fillBuf(pos, 4)) { |
||||
return gFalse; |
||||
} |
||||
*val = (buf[pos - bufPos] & 0xff) + |
||||
((buf[pos - bufPos + 1] & 0xff) << 8) + |
||||
((buf[pos - bufPos + 2] & 0xff) << 16) + |
||||
((buf[pos - bufPos + 3] & 0xff) << 24); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool FileReader::getUVarBE(int pos, int size, Guint *val) { |
||||
int i; |
||||
|
||||
if (size < 1 || size > 4 || !fillBuf(pos, size)) { |
||||
return gFalse; |
||||
} |
||||
*val = 0; |
||||
for (i = 0; i < size; ++i) { |
||||
*val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); |
||||
} |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool FileReader::cmp(int pos, char *s) { |
||||
int n; |
||||
|
||||
n = strlen(s); |
||||
if (!fillBuf(pos, n)) { |
||||
return gFalse; |
||||
} |
||||
return !memcmp(buf - bufPos + pos, s, n); |
||||
} |
||||
|
||||
GBool FileReader::fillBuf(int pos, int len) { |
||||
if (pos < 0 || len < 0 || len > (int)sizeof(buf) || |
||||
pos > INT_MAX - (int)sizeof(buf)) { |
||||
return gFalse; |
||||
} |
||||
if (pos >= bufPos && pos + len <= bufPos + bufLen) { |
||||
return gTrue; |
||||
} |
||||
if (fseek(f, pos, SEEK_SET)) { |
||||
return gFalse; |
||||
} |
||||
bufPos = pos; |
||||
bufLen = (int)fread(buf, 1, sizeof(buf), f); |
||||
if (bufLen < len) { |
||||
return gFalse; |
||||
} |
||||
return gTrue; |
||||
} |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class StreamReader: public Reader { |
||||
public: |
||||
|
||||
static StreamReader *make(int (*getCharA)(void *data), void *dataA); |
||||
virtual ~StreamReader(); |
||||
virtual int getByte(int pos); |
||||
virtual GBool getU16BE(int pos, int *val); |
||||
virtual GBool getU32BE(int pos, Guint *val); |
||||
virtual GBool getU32LE(int pos, Guint *val); |
||||
virtual GBool getUVarBE(int pos, int size, Guint *val); |
||||
virtual GBool cmp(int pos, char *s); |
||||
|
||||
private: |
||||
|
||||
StreamReader(int (*getCharA)(void *data), void *dataA); |
||||
GBool fillBuf(int pos, int len); |
||||
|
||||
int (*getChar)(void *data); |
||||
void *data; |
||||
int streamPos; |
||||
char buf[1024]; |
||||
int bufPos, bufLen; |
||||
}; |
||||
|
||||
StreamReader *StreamReader::make(int (*getCharA)(void *data), void *dataA) { |
||||
return new StreamReader(getCharA, dataA); |
||||
} |
||||
|
||||
StreamReader::StreamReader(int (*getCharA)(void *data), void *dataA) { |
||||
getChar = getCharA; |
||||
data = dataA; |
||||
streamPos = 0; |
||||
bufPos = 0; |
||||
bufLen = 0; |
||||
} |
||||
|
||||
StreamReader::~StreamReader() { |
||||
} |
||||
|
||||
int StreamReader::getByte(int pos) { |
||||
if (!fillBuf(pos, 1)) { |
||||
return -1; |
||||
} |
||||
return buf[pos - bufPos] & 0xff; |
||||
} |
||||
|
||||
GBool StreamReader::getU16BE(int pos, int *val) { |
||||
if (!fillBuf(pos, 2)) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos - bufPos] & 0xff) << 8) + |
||||
(buf[pos - bufPos + 1] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool StreamReader::getU32BE(int pos, Guint *val) { |
||||
if (!fillBuf(pos, 4)) { |
||||
return gFalse; |
||||
} |
||||
*val = ((buf[pos - bufPos] & 0xff) << 24) + |
||||
((buf[pos - bufPos + 1] & 0xff) << 16) + |
||||
((buf[pos - bufPos + 2] & 0xff) << 8) + |
||||
(buf[pos - bufPos + 3] & 0xff); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool StreamReader::getU32LE(int pos, Guint *val) { |
||||
if (!fillBuf(pos, 4)) { |
||||
return gFalse; |
||||
} |
||||
*val = (buf[pos - bufPos] & 0xff) + |
||||
((buf[pos - bufPos + 1] & 0xff) << 8) + |
||||
((buf[pos - bufPos + 2] & 0xff) << 16) + |
||||
((buf[pos - bufPos + 3] & 0xff) << 24); |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool StreamReader::getUVarBE(int pos, int size, Guint *val) { |
||||
int i; |
||||
|
||||
if (size < 1 || size > 4 || !fillBuf(pos, size)) { |
||||
return gFalse; |
||||
} |
||||
*val = 0; |
||||
for (i = 0; i < size; ++i) { |
||||
*val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); |
||||
} |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool StreamReader::cmp(int pos, char *s) { |
||||
int n; |
||||
|
||||
n = strlen(s); |
||||
if (!fillBuf(pos, n)) { |
||||
return gFalse; |
||||
} |
||||
return !memcmp(buf - bufPos + pos, s, n); |
||||
} |
||||
|
||||
GBool StreamReader::fillBuf(int pos, int len) { |
||||
int c; |
||||
|
||||
if (pos < 0 || len < 0 || len > (int)sizeof(buf) || |
||||
pos > INT_MAX - (int)sizeof(buf)) { |
||||
return gFalse; |
||||
} |
||||
if (pos < bufPos) { |
||||
return gFalse; |
||||
} |
||||
|
||||
// if requested region will not fit in the current buffer...
|
||||
if (pos + len > bufPos + (int)sizeof(buf)) { |
||||
|
||||
// if the start of the requested data is already in the buffer, move
|
||||
// it to the start of the buffer
|
||||
if (pos < bufPos + bufLen) { |
||||
bufLen -= pos - bufPos; |
||||
memmove(buf, buf + (pos - bufPos), bufLen); |
||||
bufPos = pos; |
||||
|
||||
// otherwise discard data from the
|
||||
// stream until we get to the requested position
|
||||
} else { |
||||
bufPos += bufLen; |
||||
bufLen = 0; |
||||
while (bufPos < pos) { |
||||
if ((c = (*getChar)(data)) < 0) { |
||||
return gFalse; |
||||
} |
||||
++bufPos; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// read the rest of the requested data
|
||||
while (bufPos + bufLen < pos + len) { |
||||
if ((c = (*getChar)(data)) < 0) { |
||||
return gFalse; |
||||
} |
||||
buf[bufLen++] = (char)c; |
||||
} |
||||
|
||||
return gTrue; |
||||
} |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
static FoFiIdentifierType identify(Reader *reader); |
||||
static FoFiIdentifierType identifyOpenType(Reader *reader); |
||||
static FoFiIdentifierType identifyCFF(Reader *reader, int start); |
||||
|
||||
FoFiIdentifierType FoFiIdentifier::identifyMem(char *file, int len) { |
||||
MemReader *reader; |
||||
FoFiIdentifierType type; |
||||
|
||||
if (!(reader = MemReader::make(file, len))) { |
||||
return fofiIdError; |
||||
} |
||||
type = identify(reader); |
||||
delete reader; |
||||
return type; |
||||
} |
||||
|
||||
FoFiIdentifierType FoFiIdentifier::identifyFile(char *fileName) { |
||||
FileReader *reader; |
||||
FoFiIdentifierType type; |
||||
|
||||
if (!(reader = FileReader::make(fileName))) { |
||||
return fofiIdError; |
||||
} |
||||
type = identify(reader); |
||||
delete reader; |
||||
return type; |
||||
} |
||||
|
||||
FoFiIdentifierType FoFiIdentifier::identifyStream(int (*getChar)(void *data), |
||||
void *data) { |
||||
StreamReader *reader; |
||||
FoFiIdentifierType type; |
||||
|
||||
if (!(reader = StreamReader::make(getChar, data))) { |
||||
return fofiIdError; |
||||
} |
||||
type = identify(reader); |
||||
delete reader; |
||||
return type; |
||||
} |
||||
|
||||
static FoFiIdentifierType identify(Reader *reader) { |
||||
Guint n; |
||||
|
||||
//----- PFA
|
||||
if (reader->cmp(0, "%!PS-AdobeFont-1") || |
||||
reader->cmp(0, "%!FontType1")) { |
||||
return fofiIdType1PFA; |
||||
} |
||||
|
||||
//----- PFB
|
||||
if (reader->getByte(0) == 0x80 && |
||||
reader->getByte(1) == 0x01 && |
||||
reader->getU32LE(2, &n)) { |
||||
if ((n >= 16 && reader->cmp(6, "%!PS-AdobeFont-1")) || |
||||
(n >= 11 && reader->cmp(6, "%!FontType1"))) { |
||||
return fofiIdType1PFB; |
||||
} |
||||
} |
||||
|
||||
//----- TrueType
|
||||
if ((reader->getByte(0) == 0x00 && |
||||
reader->getByte(1) == 0x01 && |
||||
reader->getByte(2) == 0x00 && |
||||
reader->getByte(3) == 0x00) || |
||||
(reader->getByte(0) == 0x74 && // 'true'
|
||||
reader->getByte(1) == 0x72 && |
||||
reader->getByte(2) == 0x75 && |
||||
reader->getByte(3) == 0x65)) { |
||||
return fofiIdTrueType; |
||||
} |
||||
if (reader->getByte(0) == 0x74 && // 'ttcf'
|
||||
reader->getByte(1) == 0x74 && |
||||
reader->getByte(2) == 0x63 && |
||||
reader->getByte(3) == 0x66) { |
||||
return fofiIdTrueTypeCollection; |
||||
} |
||||
|
||||
//----- OpenType
|
||||
if (reader->getByte(0) == 0x4f && // 'OTTO
|
||||
reader->getByte(1) == 0x54 && |
||||
reader->getByte(2) == 0x54 && |
||||
reader->getByte(3) == 0x4f) { |
||||
return identifyOpenType(reader); |
||||
} |
||||
|
||||
//----- CFF
|
||||
if (reader->getByte(0) == 0x01 && |
||||
reader->getByte(1) == 0x00) { |
||||
return identifyCFF(reader, 0); |
||||
} |
||||
// some tools embed CFF fonts with an extra whitespace char at the
|
||||
// beginning
|
||||
if (reader->getByte(1) == 0x01 && |
||||
reader->getByte(2) == 0x00) { |
||||
return identifyCFF(reader, 1); |
||||
} |
||||
|
||||
return fofiIdUnknown; |
||||
} |
||||
|
||||
static FoFiIdentifierType identifyOpenType(Reader *reader) { |
||||
FoFiIdentifierType type; |
||||
Guint offset; |
||||
int nTables, i; |
||||
|
||||
if (!reader->getU16BE(4, &nTables)) { |
||||
return fofiIdUnknown; |
||||
} |
||||
for (i = 0; i < nTables; ++i) { |
||||
if (reader->cmp(12 + i*16, "CFF ")) { |
||||
if (reader->getU32BE(12 + i*16 + 8, &offset) && |
||||
offset < (Guint)INT_MAX) { |
||||
type = identifyCFF(reader, (int)offset); |
||||
if (type == fofiIdCFF8Bit) { |
||||
type = fofiIdOpenTypeCFF8Bit; |
||||
} else if (type == fofiIdCFFCID) { |
||||
type = fofiIdOpenTypeCFFCID; |
||||
} |
||||
return type; |
||||
} |
||||
return fofiIdUnknown; |
||||
} |
||||
} |
||||
return fofiIdUnknown; |
||||
} |
||||
|
||||
static FoFiIdentifierType identifyCFF(Reader *reader, int start) { |
||||
Guint offset0, offset1; |
||||
int hdrSize, offSize0, offSize1, pos, endPos, b0, n, i; |
||||
|
||||
//----- read the header
|
||||
if (reader->getByte(start) != 0x01 || |
||||
reader->getByte(start + 1) != 0x00) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if ((hdrSize = reader->getByte(start + 2)) < 0) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if ((offSize0 = reader->getByte(start + 3)) < 1 || offSize0 > 4) { |
||||
return fofiIdUnknown; |
||||
} |
||||
pos = start + hdrSize; |
||||
if (pos < 0) { |
||||
return fofiIdUnknown; |
||||
} |
||||
|
||||
//----- skip the name index
|
||||
if (!reader->getU16BE(pos, &n)) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if (n == 0) { |
||||
pos += 2; |
||||
} else { |
||||
if ((offSize1 = reader->getByte(pos + 2)) < 1 || offSize1 > 4) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if (!reader->getUVarBE(pos + 3 + n * offSize1, offSize1, &offset1) || |
||||
offset1 > (Guint)INT_MAX) { |
||||
return fofiIdUnknown; |
||||
} |
||||
pos += 3 + (n + 1) * offSize1 + (int)offset1 - 1; |
||||
} |
||||
if (pos < 0) { |
||||
return fofiIdUnknown; |
||||
} |
||||
|
||||
//----- parse the top dict index
|
||||
if (!reader->getU16BE(pos, &n) || n < 1) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if ((offSize1 = reader->getByte(pos + 2)) < 1 || offSize1 > 4) { |
||||
return fofiIdUnknown; |
||||
} |
||||
if (!reader->getUVarBE(pos + 3, offSize1, &offset0) || |
||||
offset0 > (Guint)INT_MAX || |
||||
!reader->getUVarBE(pos + 3 + offSize1, offSize1, &offset1) || |
||||
offset1 > (Guint)INT_MAX || |
||||
offset0 > offset1) { |
||||
return fofiIdUnknown; |
||||
} |
||||
pos = pos + 3 + (n + 1) * offSize1 + (int)offset0 - 1; |
||||
endPos = pos + 3 + (n + 1) * offSize1 + (int)offset1 - 1; |
||||
if (pos < 0 || endPos < 0 || pos > endPos) { |
||||
return fofiIdUnknown; |
||||
} |
||||
|
||||
//----- parse the top dict, look for ROS as first entry
|
||||
// for a CID font, the top dict starts with:
|
||||
// <int> <int> <int> ROS
|
||||
for (i = 0; i < 3; ++i) { |
||||
b0 = reader->getByte(pos++); |
||||
if (b0 == 0x1c) { |
||||
pos += 2; |
||||
} else if (b0 == 0x1d) { |
||||
pos += 4; |
||||
} else if (b0 >= 0xf7 && b0 <= 0xfe) { |
||||
pos += 1; |
||||
} else if (b0 < 0x20 || b0 > 0xf6) { |
||||
return fofiIdCFF8Bit; |
||||
} |
||||
if (pos >= endPos || pos < 0) { |
||||
return fofiIdCFF8Bit; |
||||
} |
||||
} |
||||
if (pos + 1 < endPos && |
||||
reader->getByte(pos) == 12 && |
||||
reader->getByte(pos + 1) == 30) { |
||||
return fofiIdCFFCID; |
||||
} else { |
||||
return fofiIdCFF8Bit; |
||||
} |
||||
} |
@ -1,44 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiIdentifier.h
|
||||
//
|
||||
// Copyright 2009 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFIIDENTIFIER_H |
||||
#define FOFIIDENTIFIER_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiIdentifier
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
enum FoFiIdentifierType { |
||||
fofiIdType1PFA, // Type 1 font in PFA format
|
||||
fofiIdType1PFB, // Type 1 font in PFB format
|
||||
fofiIdCFF8Bit, // 8-bit CFF font
|
||||
fofiIdCFFCID, // CID CFF font
|
||||
fofiIdTrueType, // TrueType font
|
||||
fofiIdTrueTypeCollection, // TrueType collection
|
||||
fofiIdOpenTypeCFF8Bit, // OpenType wrapper with 8-bit CFF font
|
||||
fofiIdOpenTypeCFFCID, // OpenType wrapper with CID CFF font
|
||||
fofiIdUnknown, // unknown type
|
||||
fofiIdError // error in reading the file
|
||||
}; |
||||
|
||||
class FoFiIdentifier { |
||||
public: |
||||
|
||||
static FoFiIdentifierType identifyMem(char *file, int len); |
||||
static FoFiIdentifierType identifyFile(char *fileName); |
||||
static FoFiIdentifierType identifyStream(int (*getChar)(void *data), |
||||
void *data); |
||||
}; |
||||
|
||||
#endif |
File diff suppressed because it is too large
Load Diff
@ -1,178 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiTrueType.h
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFITRUETYPE_H |
||||
#define FOFITRUETYPE_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "FoFiBase.h" |
||||
|
||||
class GString; |
||||
class GHash; |
||||
struct TrueTypeTable; |
||||
struct TrueTypeCmap; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiTrueType
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FoFiTrueType: public FoFiBase { |
||||
public: |
||||
|
||||
// Create a FoFiTrueType object from a memory buffer.
|
||||
static FoFiTrueType *make(char *fileA, int lenA); |
||||
|
||||
// Create a FoFiTrueType object from a file on disk.
|
||||
static FoFiTrueType *load(char *fileName); |
||||
|
||||
virtual ~FoFiTrueType(); |
||||
|
||||
// Returns true if this an OpenType font containing CFF data, false
|
||||
// if it's a TrueType font (or OpenType font with TrueType data).
|
||||
GBool isOpenTypeCFF() { return openTypeCFF; } |
||||
|
||||
// Return the number of cmaps defined by this font.
|
||||
int getNumCmaps(); |
||||
|
||||
// Return the platform ID of the <i>th cmap.
|
||||
int getCmapPlatform(int i); |
||||
|
||||
// Return the encoding ID of the <i>th cmap.
|
||||
int getCmapEncoding(int i); |
||||
|
||||
// Return the index of the cmap for <platform>, <encoding>. Returns
|
||||
// -1 if there is no corresponding cmap.
|
||||
int findCmap(int platform, int encoding); |
||||
|
||||
// Return the GID corresponding to <c> according to the <i>th cmap.
|
||||
int mapCodeToGID(int i, int c); |
||||
|
||||
// Returns the GID corresponding to <name> according to the post
|
||||
// table. Returns 0 if there is no mapping for <name> or if the
|
||||
// font does not have a post table.
|
||||
int mapNameToGID(char *name); |
||||
|
||||
// Return the mapping from CIDs to GIDs, and return the number of
|
||||
// CIDs in *<nCIDs>. This is only useful for CID fonts. (Only
|
||||
// useful for OpenType CFF fonts.)
|
||||
int *getCIDToGIDMap(int *nCIDs); |
||||
|
||||
// Returns the least restrictive embedding licensing right (as
|
||||
// defined by the TrueType spec):
|
||||
// * 4: OS/2 table is missing or invalid
|
||||
// * 3: installable embedding
|
||||
// * 2: editable embedding
|
||||
// * 1: preview & print embedding
|
||||
// * 0: restricted license embedding
|
||||
int getEmbeddingRights(); |
||||
|
||||
// Return the font matrix as an array of six numbers. (Only useful
|
||||
// for OpenType CFF fonts.)
|
||||
void getFontMatrix(double *mat); |
||||
|
||||
// Convert to a Type 42 font, suitable for embedding in a PostScript
|
||||
// file. <psName> will be used as the PostScript font name (so we
|
||||
// don't need to depend on the 'name' table in the font). The
|
||||
// <encoding> array specifies the mapping from char codes to names.
|
||||
// If <encoding> is NULL, the encoding is unknown or undefined. The
|
||||
// <codeToGID> array specifies the mapping from char codes to GIDs.
|
||||
// (Not useful for OpenType CFF fonts.)
|
||||
void convertToType42(char *psName, char **encoding, |
||||
int *codeToGID, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 1 font, suitable for embedding in a PostScript
|
||||
// file. This is only useful with 8-bit fonts. If <newEncoding> is
|
||||
// not NULL, it will be used in place of the encoding in the Type 1C
|
||||
// font. If <ascii> is true the eexec section will be hex-encoded,
|
||||
// otherwise it will be left as binary data. If <psName> is
|
||||
// non-NULL, it will be used as the PostScript font name. (Only
|
||||
// useful for OpenType CFF fonts.)
|
||||
void convertToType1(char *psName, char **newEncoding, GBool ascii, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 2 CIDFont, suitable for embedding in a
|
||||
// PostScript file. <psName> will be used as the PostScript font
|
||||
// name (so we don't need to depend on the 'name' table in the
|
||||
// font). The <cidMap> array maps CIDs to GIDs; it has <nCIDs>
|
||||
// entries. (Not useful for OpenType CFF fonts.)
|
||||
void convertToCIDType2(char *psName, int *cidMap, int nCIDs, |
||||
GBool needVerticalMetrics, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 0 CIDFont, suitable for embedding in a
|
||||
// PostScript file. <psName> will be used as the PostScript font
|
||||
// name. (Only useful for OpenType CFF fonts.)
|
||||
void convertToCIDType0(char *psName, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 0 (but non-CID) composite font, suitable for
|
||||
// embedding in a PostScript file. <psName> will be used as the
|
||||
// PostScript font name (so we don't need to depend on the 'name'
|
||||
// table in the font). The <cidMap> array maps CIDs to GIDs; it has
|
||||
// <nCIDs> entries. (Not useful for OpenType CFF fonts.)
|
||||
void convertToType0(char *psName, int *cidMap, int nCIDs, |
||||
GBool needVerticalMetrics, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 0 (but non-CID) composite font, suitable for
|
||||
// embedding in a PostScript file. <psName> will be used as the
|
||||
// PostScript font name. (Only useful for OpenType CFF fonts.)
|
||||
void convertToType0(char *psName, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Write a clean TTF file, filling in missing tables and correcting
|
||||
// various other errors. If <name> is non-NULL, the font is renamed
|
||||
// to <name>. If <codeToGID> is non-NULL, the font is re-encoded,
|
||||
// using a Windows Unicode cmap. If <name> is NULL and the font is
|
||||
// complete and correct, it will be written unmodified. (Not useful
|
||||
// for OpenType CFF fonts.)
|
||||
void writeTTF(FoFiOutputFunc outputFunc, void *outputStream, |
||||
char *name = NULL, int *codeToGID = NULL); |
||||
|
||||
private: |
||||
|
||||
FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA); |
||||
void cvtEncoding(char **encoding, |
||||
FoFiOutputFunc outputFunc, |
||||
void *outputStream); |
||||
void cvtCharStrings(char **encoding, |
||||
int *codeToGID, |
||||
FoFiOutputFunc outputFunc, |
||||
void *outputStream); |
||||
void cvtSfnts(FoFiOutputFunc outputFunc, |
||||
void *outputStream, GString *name, |
||||
GBool needVerticalMetrics); |
||||
void dumpString(Guchar *s, int length, |
||||
FoFiOutputFunc outputFunc, |
||||
void *outputStream); |
||||
Guint computeTableChecksum(Guchar *data, int length); |
||||
void parse(); |
||||
void readPostTable(); |
||||
int seekTable(char *tag); |
||||
|
||||
TrueTypeTable *tables; |
||||
int nTables; |
||||
TrueTypeCmap *cmaps; |
||||
int nCmaps; |
||||
int nGlyphs; |
||||
int locaFmt; |
||||
int bbox[4]; |
||||
GHash *nameToGID; |
||||
GBool openTypeCFF; |
||||
|
||||
GBool parsedOk; |
||||
}; |
||||
|
||||
#endif |
@ -1,338 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiType1.cc
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include "gmem.h" |
||||
#include "FoFiEncodings.h" |
||||
#include "FoFiType1.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiType1
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
FoFiType1 *FoFiType1::make(char *fileA, int lenA) { |
||||
return new FoFiType1(fileA, lenA, gFalse); |
||||
} |
||||
|
||||
FoFiType1 *FoFiType1::load(char *fileName) { |
||||
char *fileA; |
||||
int lenA; |
||||
|
||||
if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { |
||||
return NULL; |
||||
} |
||||
return new FoFiType1(fileA, lenA, gTrue); |
||||
} |
||||
|
||||
FoFiType1::FoFiType1(char *fileA, int lenA, GBool freeFileDataA): |
||||
FoFiBase(fileA, lenA, freeFileDataA) |
||||
{ |
||||
name = NULL; |
||||
encoding = NULL; |
||||
fontMatrix[0] = 0.001; |
||||
fontMatrix[1] = 0; |
||||
fontMatrix[2] = 0; |
||||
fontMatrix[3] = 0.001; |
||||
fontMatrix[4] = 0; |
||||
fontMatrix[5] = 0; |
||||
parsed = gFalse; |
||||
undoPFB(); |
||||
} |
||||
|
||||
FoFiType1::~FoFiType1() { |
||||
int i; |
||||
|
||||
if (name) { |
||||
gfree(name); |
||||
} |
||||
if (encoding && encoding != fofiType1StandardEncoding) { |
||||
for (i = 0; i < 256; ++i) { |
||||
gfree(encoding[i]); |
||||
} |
||||
gfree(encoding); |
||||
} |
||||
} |
||||
|
||||
char *FoFiType1::getName() { |
||||
if (!parsed) { |
||||
parse(); |
||||
} |
||||
return name; |
||||
} |
||||
|
||||
char **FoFiType1::getEncoding() { |
||||
if (!parsed) { |
||||
parse(); |
||||
} |
||||
return encoding; |
||||
} |
||||
|
||||
void FoFiType1::getFontMatrix(double *mat) { |
||||
int i; |
||||
|
||||
if (!parsed) { |
||||
parse(); |
||||
} |
||||
for (i = 0; i < 6; ++i) { |
||||
mat[i] = fontMatrix[i]; |
||||
} |
||||
} |
||||
|
||||
void FoFiType1::writeEncoded(char **newEncoding, |
||||
FoFiOutputFunc outputFunc, void *outputStream) { |
||||
char buf[512]; |
||||
char *line, *line2, *p; |
||||
int i; |
||||
|
||||
// copy everything up to the encoding
|
||||
for (line = (char *)file; |
||||
line && strncmp(line, "/Encoding", 9); |
||||
line = getNextLine(line)) ; |
||||
if (!line) { |
||||
// no encoding - just copy the whole font file
|
||||
(*outputFunc)(outputStream, (char *)file, len); |
||||
return; |
||||
} |
||||
(*outputFunc)(outputStream, (char *)file, line - (char *)file); |
||||
|
||||
// write the new encoding
|
||||
(*outputFunc)(outputStream, "/Encoding 256 array\n", 20); |
||||
(*outputFunc)(outputStream, |
||||
"0 1 255 {1 index exch /.notdef put} for\n", 40); |
||||
for (i = 0; i < 256; ++i) { |
||||
if (newEncoding[i]) { |
||||
sprintf(buf, "dup %d /%s put\n", i, newEncoding[i]); |
||||
(*outputFunc)(outputStream, buf, strlen(buf)); |
||||
} |
||||
} |
||||
(*outputFunc)(outputStream, "readonly def\n", 13); |
||||
|
||||
// find the end of the encoding data
|
||||
//~ this ought to parse PostScript tokens
|
||||
if (!strncmp(line, "/Encoding StandardEncoding def", 30)) { |
||||
line = getNextLine(line); |
||||
} else { |
||||
// skip "/Encoding" + one whitespace char,
|
||||
// then look for 'def' preceded by PostScript whitespace
|
||||
p = line + 10; |
||||
line = NULL; |
||||
for (; p < (char *)file + len; ++p) { |
||||
if ((*p == ' ' || *p == '\t' || *p == '\x0a' || |
||||
*p == '\x0d' || *p == '\x0c' || *p == '\0') && |
||||
p + 4 <= (char *)file + len && |
||||
!strncmp(p + 1, "def", 3)) { |
||||
line = p + 4; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// some fonts have two /Encoding entries in their dictionary, so we
|
||||
// check for a second one here
|
||||
if (line) { |
||||
for (line2 = line, i = 0; |
||||
i < 20 && line2 && strncmp(line2, "/Encoding", 9); |
||||
line2 = getNextLine(line2), ++i) ; |
||||
if (i < 20 && line2) { |
||||
(*outputFunc)(outputStream, line, line2 - line); |
||||
if (!strncmp(line2, "/Encoding StandardEncoding def", 30)) { |
||||
line = getNextLine(line2); |
||||
} else { |
||||
// skip "/Encoding" + one whitespace char,
|
||||
// then look for 'def' preceded by PostScript whitespace
|
||||
p = line2 + 10; |
||||
line = NULL; |
||||
for (; p < (char *)file + len; ++p) { |
||||
if ((*p == ' ' || *p == '\t' || *p == '\x0a' || |
||||
*p == '\x0d' || *p == '\x0c' || *p == '\0') && |
||||
p + 4 <= (char *)file + len && |
||||
!strncmp(p + 1, "def", 3)) { |
||||
line = p + 4; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// copy everything after the encoding
|
||||
if (line) { |
||||
(*outputFunc)(outputStream, line, ((char *)file + len) - line); |
||||
} |
||||
} |
||||
} |
||||
|
||||
char *FoFiType1::getNextLine(char *line) { |
||||
while (line < (char *)file + len && *line != '\x0a' && *line != '\x0d') { |
||||
++line; |
||||
} |
||||
if (line < (char *)file + len && *line == '\x0d') { |
||||
++line; |
||||
} |
||||
if (line < (char *)file + len && *line == '\x0a') { |
||||
++line; |
||||
} |
||||
if (line >= (char *)file + len) { |
||||
return NULL; |
||||
} |
||||
return line; |
||||
} |
||||
|
||||
void FoFiType1::parse() { |
||||
char *line, *line1, *p, *p2; |
||||
char buf[256]; |
||||
char c; |
||||
int n, code, base, i, j; |
||||
GBool gotMatrix; |
||||
|
||||
gotMatrix = gFalse; |
||||
for (i = 1, line = (char *)file; |
||||
i <= 100 && line && (!name || !encoding); |
||||
++i) { |
||||
|
||||
// get font name
|
||||
if (!name && !strncmp(line, "/FontName", 9)) { |
||||
strncpy(buf, line, 255); |
||||
buf[255] = '\0'; |
||||
if ((p = strchr(buf+9, '/')) && |
||||
(p = strtok(p+1, " \t\n\r"))) { |
||||
name = copyString(p); |
||||
} |
||||
line = getNextLine(line); |
||||
|
||||
// get encoding
|
||||
} else if (!encoding && |
||||
!strncmp(line, "/Encoding StandardEncoding def", 30)) { |
||||
encoding = fofiType1StandardEncoding; |
||||
} else if (!encoding && |
||||
!strncmp(line, "/Encoding 256 array", 19)) { |
||||
encoding = (char **)gmallocn(256, sizeof(char *)); |
||||
for (j = 0; j < 256; ++j) { |
||||
encoding[j] = NULL; |
||||
} |
||||
for (j = 0, line = getNextLine(line); |
||||
j < 300 && line && (line1 = getNextLine(line)); |
||||
++j, line = line1) { |
||||
if ((n = line1 - line) > 255) { |
||||
n = 255; |
||||
} |
||||
strncpy(buf, line, n); |
||||
buf[n] = '\0'; |
||||
for (p = buf; *p == ' ' || *p == '\t'; ++p) ; |
||||
if (!strncmp(p, "dup", 3)) { |
||||
while (1) { |
||||
p += 3; |
||||
for (; *p == ' ' || *p == '\t'; ++p) ; |
||||
code = 0; |
||||
if (*p == '8' && p[1] == '#') { |
||||
base = 8; |
||||
p += 2; |
||||
} else if (*p >= '0' && *p <= '9') { |
||||
base = 10; |
||||
} else { |
||||
break; |
||||
} |
||||
for (; *p >= '0' && *p < '0' + base; ++p) { |
||||
code = code * base + (*p - '0'); |
||||
} |
||||
for (; *p == ' ' || *p == '\t'; ++p) ; |
||||
if (*p != '/') { |
||||
break; |
||||
} |
||||
++p; |
||||
for (p2 = p; *p2 && *p2 != ' ' && *p2 != '\t'; ++p2) ; |
||||
if (code < 256) { |
||||
c = *p2; |
||||
*p2 = '\0'; |
||||
encoding[code] = copyString(p); |
||||
*p2 = c; |
||||
} |
||||
for (p = p2; *p == ' ' || *p == '\t'; ++p) ; |
||||
if (strncmp(p, "put", 3)) { |
||||
break; |
||||
} |
||||
for (p += 3; *p == ' ' || *p == '\t'; ++p) ; |
||||
if (strncmp(p, "dup", 3)) { |
||||
break; |
||||
} |
||||
} |
||||
} else { |
||||
if (strtok(buf, " \t") && |
||||
(p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) { |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
//~ check for getinterval/putinterval junk
|
||||
|
||||
} else if (!gotMatrix && !strncmp(line, "/FontMatrix", 11)) { |
||||
strncpy(buf, line + 11, 255); |
||||
buf[255] = '\0'; |
||||
if ((p = strchr(buf, '['))) { |
||||
++p; |
||||
if ((p2 = strchr(p, ']'))) { |
||||
*p2 = '\0'; |
||||
for (j = 0; j < 6; ++j) { |
||||
if ((p = strtok(j == 0 ? p : NULL, " \t\n\r"))) { |
||||
fontMatrix[j] = atof(p); |
||||
} else { |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
gotMatrix = gTrue; |
||||
|
||||
} else { |
||||
line = getNextLine(line); |
||||
} |
||||
} |
||||
|
||||
parsed = gTrue; |
||||
} |
||||
|
||||
// Undo the PFB encoding, i.e., remove the PFB headers.
|
||||
void FoFiType1::undoPFB() { |
||||
GBool ok; |
||||
Guchar *file2; |
||||
int pos1, pos2, type; |
||||
Guint segLen; |
||||
|
||||
ok = gTrue; |
||||
if (getU8(0, &ok) != 0x80 || !ok) { |
||||
return; |
||||
} |
||||
file2 = (Guchar *)gmalloc(len); |
||||
pos1 = pos2 = 0; |
||||
while (getU8(pos1, &ok) == 0x80 && ok) { |
||||
type = getU8(pos1 + 1, &ok); |
||||
if (type < 1 || type > 2 || !ok) { |
||||
break; |
||||
} |
||||
segLen = getU32LE(pos1 + 2, &ok); |
||||
pos1 += 6; |
||||
if (!ok || !checkRegion(pos1, segLen)) { |
||||
break; |
||||
} |
||||
memcpy(file2 + pos2, file + pos1, segLen); |
||||
pos1 += segLen; |
||||
pos2 += segLen; |
||||
} |
||||
if (freeFileData) { |
||||
gfree(fileData); |
||||
} |
||||
file = fileData = file2; |
||||
freeFileData = gTrue; |
||||
len = pos2; |
||||
} |
@ -1,64 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiType1.h
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFITYPE1_H |
||||
#define FOFITYPE1_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "FoFiBase.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiType1
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FoFiType1: public FoFiBase { |
||||
public: |
||||
|
||||
// Create a FoFiType1 object from a memory buffer.
|
||||
static FoFiType1 *make(char *fileA, int lenA); |
||||
|
||||
// Create a FoFiType1 object from a file on disk.
|
||||
static FoFiType1 *load(char *fileName); |
||||
|
||||
virtual ~FoFiType1(); |
||||
|
||||
// Return the font name.
|
||||
char *getName(); |
||||
|
||||
// Return the encoding, as an array of 256 names (any of which may
|
||||
// be NULL).
|
||||
char **getEncoding(); |
||||
|
||||
// Return the font matrix as an array of six numbers.
|
||||
void getFontMatrix(double *mat); |
||||
|
||||
// Write a version of the Type 1 font file with a new encoding.
|
||||
void writeEncoded(char **newEncoding, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
private: |
||||
|
||||
FoFiType1(char *fileA, int lenA, GBool freeFileDataA); |
||||
|
||||
char *getNextLine(char *line); |
||||
void parse(); |
||||
void undoPFB(); |
||||
|
||||
char *name; |
||||
char **encoding; |
||||
double fontMatrix[6]; |
||||
GBool parsed; |
||||
}; |
||||
|
||||
#endif |
File diff suppressed because it is too large
Load Diff
@ -1,237 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FoFiType1C.h
|
||||
//
|
||||
// Copyright 1999-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FOFITYPE1C_H |
||||
#define FOFITYPE1C_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
#include "FoFiBase.h" |
||||
|
||||
class GString; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
struct Type1CIndex { |
||||
int pos; // absolute position in file
|
||||
int len; // length (number of entries)
|
||||
int offSize; // offset size
|
||||
int startPos; // position of start of index data - 1
|
||||
int endPos; // position one byte past end of the index
|
||||
}; |
||||
|
||||
struct Type1CIndexVal { |
||||
int pos; // absolute position in file
|
||||
int len; // length, in bytes
|
||||
}; |
||||
|
||||
struct Type1CTopDict { |
||||
int firstOp; |
||||
|
||||
int versionSID; |
||||
int noticeSID; |
||||
int copyrightSID; |
||||
int fullNameSID; |
||||
int familyNameSID; |
||||
int weightSID; |
||||
int isFixedPitch; |
||||
double italicAngle; |
||||
double underlinePosition; |
||||
double underlineThickness; |
||||
int paintType; |
||||
int charstringType; |
||||
double fontMatrix[6]; |
||||
GBool hasFontMatrix; // CID fonts are allowed to put their
|
||||
// FontMatrix in the FD instead of the
|
||||
// top dict
|
||||
int uniqueID; |
||||
double fontBBox[4]; |
||||
double strokeWidth; |
||||
int charsetOffset; |
||||
int encodingOffset; |
||||
int charStringsOffset; |
||||
int privateSize; |
||||
int privateOffset; |
||||
|
||||
// CIDFont entries
|
||||
int registrySID; |
||||
int orderingSID; |
||||
int supplement; |
||||
int fdArrayOffset; |
||||
int fdSelectOffset; |
||||
}; |
||||
|
||||
#define type1CMaxBlueValues 14 |
||||
#define type1CMaxOtherBlues 10 |
||||
#define type1CMaxStemSnap 12 |
||||
|
||||
struct Type1CPrivateDict { |
||||
double fontMatrix[6]; |
||||
GBool hasFontMatrix; |
||||
int blueValues[type1CMaxBlueValues]; |
||||
int nBlueValues; |
||||
int otherBlues[type1CMaxOtherBlues]; |
||||
int nOtherBlues; |
||||
int familyBlues[type1CMaxBlueValues]; |
||||
int nFamilyBlues; |
||||
int familyOtherBlues[type1CMaxOtherBlues]; |
||||
int nFamilyOtherBlues; |
||||
double blueScale; |
||||
int blueShift; |
||||
int blueFuzz; |
||||
double stdHW; |
||||
GBool hasStdHW; |
||||
double stdVW; |
||||
GBool hasStdVW; |
||||
double stemSnapH[type1CMaxStemSnap]; |
||||
int nStemSnapH; |
||||
double stemSnapV[type1CMaxStemSnap]; |
||||
int nStemSnapV; |
||||
GBool forceBold; |
||||
GBool hasForceBold; |
||||
double forceBoldThreshold; |
||||
int languageGroup; |
||||
double expansionFactor; |
||||
int initialRandomSeed; |
||||
int subrsOffset; |
||||
double defaultWidthX; |
||||
GBool defaultWidthXFP; |
||||
double nominalWidthX; |
||||
GBool nominalWidthXFP; |
||||
}; |
||||
|
||||
struct Type1COp { |
||||
GBool isNum; // true -> number, false -> operator
|
||||
GBool isFP; // true -> floating point number, false -> int
|
||||
union { |
||||
double num; // if num is true
|
||||
int op; // if num is false
|
||||
}; |
||||
}; |
||||
|
||||
struct Type1CEexecBuf { |
||||
FoFiOutputFunc outputFunc; |
||||
void *outputStream; |
||||
GBool ascii; // ASCII encoding?
|
||||
Gushort r1; // eexec encryption key
|
||||
int line; // number of eexec chars left on current line
|
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FoFiType1C
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class FoFiType1C: public FoFiBase { |
||||
public: |
||||
|
||||
// Create a FoFiType1C object from a memory buffer.
|
||||
static FoFiType1C *make(char *fileA, int lenA); |
||||
|
||||
// Create a FoFiType1C object from a file on disk.
|
||||
static FoFiType1C *load(char *fileName); |
||||
|
||||
virtual ~FoFiType1C(); |
||||
|
||||
// Return the font name.
|
||||
char *getName(); |
||||
|
||||
// Return the encoding, as an array of 256 names (any of which may
|
||||
// be NULL). This is only useful with 8-bit fonts.
|
||||
char **getEncoding(); |
||||
|
||||
// Return the mapping from CIDs to GIDs, and return the number of
|
||||
// CIDs in *<nCIDs>. This is only useful for CID fonts.
|
||||
int *getCIDToGIDMap(int *nCIDs); |
||||
|
||||
// Return the font matrix as an array of six numbers.
|
||||
void getFontMatrix(double *mat); |
||||
|
||||
// Convert to a Type 1 font, suitable for embedding in a PostScript
|
||||
// file. This is only useful with 8-bit fonts. If <newEncoding> is
|
||||
// not NULL, it will be used in place of the encoding in the Type 1C
|
||||
// font. If <ascii> is true the eexec section will be hex-encoded,
|
||||
// otherwise it will be left as binary data. If <psName> is non-NULL,
|
||||
// it will be used as the PostScript font name.
|
||||
void convertToType1(char *psName, char **newEncoding, GBool ascii, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 0 CIDFont, suitable for embedding in a
|
||||
// PostScript file. <psName> will be used as the PostScript font
|
||||
// name.
|
||||
void convertToCIDType0(char *psName, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
// Convert to a Type 0 (but non-CID) composite font, suitable for
|
||||
// embedding in a PostScript file. <psName> will be used as the
|
||||
// PostScript font name.
|
||||
void convertToType0(char *psName, |
||||
FoFiOutputFunc outputFunc, void *outputStream); |
||||
|
||||
private: |
||||
|
||||
FoFiType1C(char *fileA, int lenA, GBool freeFileDataA); |
||||
void eexecCvtGlyph(Type1CEexecBuf *eb, char *glyphName, |
||||
int offset, int nBytes, |
||||
Type1CIndex *subrIdx, |
||||
Type1CPrivateDict *pDict); |
||||
void cvtGlyph(int offset, int nBytes, GString *charBuf, |
||||
Type1CIndex *subrIdx, Type1CPrivateDict *pDict, |
||||
GBool top); |
||||
void cvtGlyphWidth(GBool useOp, GString *charBuf, |
||||
Type1CPrivateDict *pDict); |
||||
void cvtNum(double x, GBool isFP, GString *charBuf); |
||||
void eexecWrite(Type1CEexecBuf *eb, char *s); |
||||
void eexecWriteCharstring(Type1CEexecBuf *eb, Guchar *s, int n); |
||||
void writePSString(char *s, FoFiOutputFunc outputFunc, void *outputStream); |
||||
GBool parse(); |
||||
void readTopDict(); |
||||
void readFD(int offset, int length, Type1CPrivateDict *pDict); |
||||
void readPrivateDict(int offset, int length, Type1CPrivateDict *pDict); |
||||
void readFDSelect(); |
||||
void buildEncoding(); |
||||
GBool readCharset(); |
||||
int getOp(int pos, GBool charstring, GBool *ok); |
||||
int getDeltaIntArray(int *arr, int maxLen); |
||||
int getDeltaFPArray(double *arr, int maxLen); |
||||
void getIndex(int pos, Type1CIndex *idx, GBool *ok); |
||||
void getIndexVal(Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok); |
||||
char *getString(int sid, char *buf, GBool *ok); |
||||
|
||||
GString *name; |
||||
char **encoding; |
||||
|
||||
Type1CIndex nameIdx; |
||||
Type1CIndex topDictIdx; |
||||
Type1CIndex stringIdx; |
||||
Type1CIndex gsubrIdx; |
||||
Type1CIndex charStringsIdx; |
||||
|
||||
Type1CTopDict topDict; |
||||
Type1CPrivateDict *privateDicts; |
||||
|
||||
int nGlyphs; |
||||
int nFDs; |
||||
Guchar *fdSelect; |
||||
Gushort *charset; |
||||
int gsubrBias; |
||||
|
||||
GBool parsedOk; |
||||
|
||||
Type1COp ops[49]; // operands and operator
|
||||
int nOps; // number of operands
|
||||
int nHints; // number of hints for the current glyph
|
||||
GBool firstOp; // true if we haven't hit the first op yet
|
||||
GBool openPath; // true if there is an unclosed path
|
||||
}; |
||||
|
||||
#endif |
@ -1,71 +0,0 @@ |
||||
#========================================================================
|
||||
#
|
||||
# FoFi library Makefile
|
||||
#
|
||||
# Copyright 2003 Glyph & Cog, LLC
|
||||
#
|
||||
#========================================================================
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
GOOSRCDIR = $(srcdir)/../goo
|
||||
GOOLIBDIR = ../goo
|
||||
|
||||
CXXFLAGS = @CXXFLAGS@ @DEFS@ -I.. -I$(GOOSRCDIR) -I$(srcdir)
|
||||
|
||||
CXX = @CXX@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
LIBPREFIX = @LIBPREFIX@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
.SUFFIXES: .cc |
||||
|
||||
.cc.o: |
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
CXX_SRC = \
|
||||
$(srcdir)/FoFiBase.cc \
|
||||
$(srcdir)/FoFiEncodings.cc \
|
||||
$(srcdir)/FoFiIdentifier.cc \
|
||||
$(srcdir)/FoFiTrueType.cc \
|
||||
$(srcdir)/FoFiType1.cc \
|
||||
$(srcdir)/FoFiType1C.cc
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
all: $(LIBPREFIX)fofi.a |
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
FOFI_OBJS = \
|
||||
FoFiBase.o \
|
||||
FoFiEncodings.o \
|
||||
FoFiIdentifier.o \
|
||||
FoFiTrueType.o \
|
||||
FoFiType1.o \
|
||||
FoFiType1C.o
|
||||
|
||||
$(LIBPREFIX)fofi.a: $(FOFI_OBJS) |
||||
rm -f $(LIBPREFIX)fofi.a
|
||||
$(AR) $(LIBPREFIX)fofi.a $(FOFI_OBJS)
|
||||
$(RANLIB) $(LIBPREFIX)fofi.a
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
clean: |
||||
rm -f $(FOFI_OBJS) $(LIBPREFIX)fofi.a
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
depend: |
||||
$(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >Makefile.dep
|
||||
|
||||
include Makefile.dep |
@ -1,118 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FixedPoint.cc
|
||||
//
|
||||
// Fixed point type, with C++ operators.
|
||||
//
|
||||
// Copyright 2004 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#if USE_FIXEDPOINT |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include "FixedPoint.h" |
||||
|
||||
#define ln2 ((FixedPoint)0.69314718) |
||||
|
||||
FixedPoint FixedPoint::sqrt(FixedPoint x) { |
||||
FixedPoint y0, y1, z; |
||||
|
||||
if (x.val <= 0) { |
||||
y1.val = 0; |
||||
} else { |
||||
y1.val = x.val == 1 ? 2 : x.val >> 1; |
||||
do { |
||||
y0.val = y1.val; |
||||
z = x / y0; |
||||
y1.val = (y0.val + z.val) >> 1; |
||||
} while (::abs(y0.val - y1.val) > 1); |
||||
} |
||||
return y1; |
||||
} |
||||
|
||||
FixedPoint FixedPoint::pow(FixedPoint x, FixedPoint y) { |
||||
FixedPoint t, t2, lnx0, lnx, z0, z; |
||||
int d, n, i; |
||||
|
||||
if (y.val <= 0) { |
||||
z.val = 0; |
||||
} else { |
||||
// y * ln(x)
|
||||
t = (x - 1) / (x + 1); |
||||
t2 = t * t; |
||||
d = 1; |
||||
lnx = 0; |
||||
do { |
||||
lnx0 = lnx; |
||||
lnx += t / d; |
||||
t *= t2; |
||||
d += 2; |
||||
} while (::abs(lnx.val - lnx0.val) > 2); |
||||
lnx.val <<= 1; |
||||
t = y * lnx; |
||||
// exp(y * ln(x))
|
||||
n = floor(t / ln2); |
||||
t -= ln2 * n; |
||||
t2 = t; |
||||
d = 1; |
||||
i = 1; |
||||
z = 1; |
||||
do { |
||||
z0 = z; |
||||
z += t2 / d; |
||||
t2 *= t; |
||||
++i; |
||||
d *= i; |
||||
} while (::abs(z.val - z0.val) > 2 && d < (1 << fixptShift)); |
||||
if (n >= 0) { |
||||
z.val <<= n; |
||||
} else if (n < 0) { |
||||
z.val >>= -n; |
||||
} |
||||
} |
||||
return z; |
||||
} |
||||
|
||||
int FixedPoint::mul(int x, int y) { |
||||
#if 1 //~tmp
|
||||
return ((FixPtInt64)x * y) >> fixptShift; |
||||
#else |
||||
int ah0, ah, bh, al, bl; |
||||
ah0 = x & fixptMaskH; |
||||
ah = x >> fixptShift; |
||||
al = x - ah0; |
||||
bh = y >> fixptShift; |
||||
bl = y - (bh << fixptShift); |
||||
return ah0 * bh + ah * bl + al * bh + ((al * bl) >> fixptShift); |
||||
#endif |
||||
} |
||||
|
||||
int FixedPoint::div(int x, int y) { |
||||
#if 1 //~tmp
|
||||
return ((FixPtInt64)x << fixptShift) / y; |
||||
#else |
||||
#endif |
||||
} |
||||
|
||||
GBool FixedPoint::divCheck(FixedPoint x, FixedPoint y, FixedPoint *result) { |
||||
#if 1 //~tmp
|
||||
FixPtInt64 z; |
||||
|
||||
z = ((FixPtInt64)x.val << fixptShift) / y.val; |
||||
if ((z == 0 && x != 0) || |
||||
z >= ((FixPtInt64)1 << 31) || z < -((FixPtInt64)1 << 31)) { |
||||
return gFalse; |
||||
} |
||||
result->val = z; |
||||
return gTrue; |
||||
#else |
||||
#endif |
||||
} |
||||
|
||||
#endif // USE_FIXEDPOINT
|
@ -1,155 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// FixedPoint.h
|
||||
//
|
||||
// Fixed point type, with C++ operators.
|
||||
//
|
||||
// Copyright 2004 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef FIXEDPOINT_H |
||||
#define FIXEDPOINT_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#if USE_FIXEDPOINT |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include "gtypes.h" |
||||
|
||||
#define fixptShift 16 |
||||
#define fixptMaskL ((1 << fixptShift) - 1) |
||||
#define fixptMaskH (~fixptMaskL) |
||||
|
||||
typedef long long FixPtInt64; |
||||
|
||||
class FixedPoint { |
||||
public: |
||||
|
||||
FixedPoint() { val = 0; } |
||||
FixedPoint(const FixedPoint &x) { val = x.val; } |
||||
FixedPoint(double x) { val = (int)(x * (1 << fixptShift) + 0.5); } |
||||
FixedPoint(int x) { val = x << fixptShift; } |
||||
FixedPoint(long x) { val = x << fixptShift; } |
||||
|
||||
operator float() |
||||
{ return (float) val * ((float)1 / (float)(1 << fixptShift)); } |
||||
operator double() |
||||
{ return (double) val * (1.0 / (double)(1 << fixptShift)); } |
||||
operator int() |
||||
{ return val >> fixptShift; } |
||||
|
||||
int getRaw() { return val; } |
||||
|
||||
FixedPoint operator =(FixedPoint x) { val = x.val; return *this; } |
||||
|
||||
int operator ==(FixedPoint x) { return val == x.val; } |
||||
int operator ==(double x) { return *this == (FixedPoint)x; } |
||||
int operator ==(int x) { return *this == (FixedPoint)x; } |
||||
int operator ==(long x) { return *this == (FixedPoint)x; } |
||||
|
||||
int operator !=(FixedPoint x) { return val != x.val; } |
||||
int operator !=(double x) { return *this != (FixedPoint)x; } |
||||
int operator !=(int x) { return *this != (FixedPoint)x; } |
||||
int operator !=(long x) { return *this != (FixedPoint)x; } |
||||
|
||||
int operator <(FixedPoint x) { return val < x.val; } |
||||
int operator <(double x) { return *this < (FixedPoint)x; } |
||||
int operator <(int x) { return *this < (FixedPoint)x; } |
||||
int operator <(long x) { return *this < (FixedPoint)x; } |
||||
|
||||
int operator <=(FixedPoint x) { return val <= x.val; } |
||||
int operator <=(double x) { return *this <= (FixedPoint)x; } |
||||
int operator <=(int x) { return *this <= (FixedPoint)x; } |
||||
int operator <=(long x) { return *this <= (FixedPoint)x; } |
||||
|
||||
int operator >(FixedPoint x) { return val > x.val; } |
||||
int operator >(double x) { return *this > (FixedPoint)x; } |
||||
int operator >(int x) { return *this > (FixedPoint)x; } |
||||
int operator >(long x) { return *this > (FixedPoint)x; } |
||||
|
||||
int operator >=(FixedPoint x) { return val >= x.val; } |
||||
int operator >=(double x) { return *this >= (FixedPoint)x; } |
||||
int operator >=(int x) { return *this >= (FixedPoint)x; } |
||||
int operator >=(long x) { return *this >= (FixedPoint)x; } |
||||
|
||||
FixedPoint operator -() { return make(-val); } |
||||
|
||||
FixedPoint operator +(FixedPoint x) { return make(val + x.val); } |
||||
FixedPoint operator +(double x) { return *this + (FixedPoint)x; } |
||||
FixedPoint operator +(int x) { return *this + (FixedPoint)x; } |
||||
FixedPoint operator +(long x) { return *this + (FixedPoint)x; } |
||||
|
||||
FixedPoint operator +=(FixedPoint x) { val = val + x.val; return *this; } |
||||
FixedPoint operator +=(double x) { return *this += (FixedPoint)x; } |
||||
FixedPoint operator +=(int x) { return *this += (FixedPoint)x; } |
||||
FixedPoint operator +=(long x) { return *this += (FixedPoint)x; } |
||||
|
||||
FixedPoint operator -(FixedPoint x) { return make(val - x.val); } |
||||
FixedPoint operator -(double x) { return *this - (FixedPoint)x; } |
||||
FixedPoint operator -(int x) { return *this - (FixedPoint)x; } |
||||
FixedPoint operator -(long x) { return *this - (FixedPoint)x; } |
||||
|
||||
FixedPoint operator -=(FixedPoint x) { val = val - x.val; return *this; } |
||||
FixedPoint operator -=(double x) { return *this -= (FixedPoint)x; } |
||||
FixedPoint operator -=(int x) { return *this -= (FixedPoint)x; } |
||||
FixedPoint operator -=(long x) { return *this -= (FixedPoint)x; } |
||||
|
||||
FixedPoint operator *(FixedPoint x) { return make(mul(val, x.val)); } |
||||
FixedPoint operator *(double x) { return *this * (FixedPoint)x; } |
||||
FixedPoint operator *(int x) { return *this * (FixedPoint)x; } |
||||
FixedPoint operator *(long x) { return *this * (FixedPoint)x; } |
||||
|
||||
FixedPoint operator *=(FixedPoint x) { val = mul(val, x.val); return *this; } |
||||
FixedPoint operator *=(double x) { return *this *= (FixedPoint)x; } |
||||
FixedPoint operator *=(int x) { return *this *= (FixedPoint)x; } |
||||
FixedPoint operator *=(long x) { return *this *= (FixedPoint)x; } |
||||
|
||||
FixedPoint operator /(FixedPoint x) { return make(div(val, x.val)); } |
||||
FixedPoint operator /(double x) { return *this / (FixedPoint)x; } |
||||
FixedPoint operator /(int x) { return *this / (FixedPoint)x; } |
||||
FixedPoint operator /(long x) { return *this / (FixedPoint)x; } |
||||
|
||||
FixedPoint operator /=(FixedPoint x) { val = div(val, x.val); return *this; } |
||||
FixedPoint operator /=(double x) { return *this /= (FixedPoint)x; } |
||||
FixedPoint operator /=(int x) { return *this /= (FixedPoint)x; } |
||||
FixedPoint operator /=(long x) { return *this /= (FixedPoint)x; } |
||||
|
||||
static FixedPoint abs(FixedPoint x) { return make(::abs(x.val)); } |
||||
|
||||
static int floor(FixedPoint x) { return x.val >> fixptShift; } |
||||
|
||||
static int ceil(FixedPoint x) |
||||
{ return (x.val & fixptMaskL) ? ((x.val >> fixptShift) + 1) |
||||
: (x.val >> fixptShift); } |
||||
|
||||
static int round(FixedPoint x) |
||||
{ return (x.val + (1 << (fixptShift - 1))) >> fixptShift; } |
||||
|
||||
static FixedPoint sqrt(FixedPoint x); |
||||
|
||||
static FixedPoint pow(FixedPoint x, FixedPoint y); |
||||
|
||||
// Compute *result = x/y; return false if there is an underflow or
|
||||
// overflow.
|
||||
static GBool divCheck(FixedPoint x, FixedPoint y, FixedPoint *result); |
||||
|
||||
private: |
||||
|
||||
static FixedPoint make(int valA) { FixedPoint x; x.val = valA; return x; } |
||||
|
||||
static int mul(int x, int y); |
||||
static int div(int x, int y); |
||||
|
||||
int val; // 16.16 fixed point
|
||||
}; |
||||
|
||||
#endif // USE_FIXEDPOINT
|
||||
|
||||
#endif |
@ -1,380 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GHash.cc
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include "gmem.h" |
||||
#include "GString.h" |
||||
#include "GHash.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
struct GHashBucket { |
||||
GString *key; |
||||
union { |
||||
void *p; |
||||
int i; |
||||
} val; |
||||
GHashBucket *next; |
||||
}; |
||||
|
||||
struct GHashIter { |
||||
int h; |
||||
GHashBucket *p; |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
GHash::GHash(GBool deleteKeysA) { |
||||
int h; |
||||
|
||||
deleteKeys = deleteKeysA; |
||||
size = 7; |
||||
tab = (GHashBucket **)gmallocn(size, sizeof(GHashBucket *)); |
||||
for (h = 0; h < size; ++h) { |
||||
tab[h] = NULL; |
||||
} |
||||
len = 0; |
||||
} |
||||
|
||||
GHash::~GHash() { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
for (h = 0; h < size; ++h) { |
||||
while (tab[h]) { |
||||
p = tab[h]; |
||||
tab[h] = p->next; |
||||
if (deleteKeys) { |
||||
delete p->key; |
||||
} |
||||
delete p; |
||||
} |
||||
} |
||||
gfree(tab); |
||||
} |
||||
|
||||
void GHash::add(GString *key, void *val) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
// expand the table if necessary
|
||||
if (len >= size) { |
||||
expand(); |
||||
} |
||||
|
||||
// add the new symbol
|
||||
p = new GHashBucket; |
||||
p->key = key; |
||||
p->val.p = val; |
||||
h = hash(key); |
||||
p->next = tab[h]; |
||||
tab[h] = p; |
||||
++len; |
||||
} |
||||
|
||||
void GHash::add(GString *key, int val) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
// expand the table if necessary
|
||||
if (len >= size) { |
||||
expand(); |
||||
} |
||||
|
||||
// add the new symbol
|
||||
p = new GHashBucket; |
||||
p->key = key; |
||||
p->val.i = val; |
||||
h = hash(key); |
||||
p->next = tab[h]; |
||||
tab[h] = p; |
||||
++len; |
||||
} |
||||
|
||||
void GHash::replace(GString *key, void *val) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if ((p = find(key, &h))) { |
||||
p->val.p = val; |
||||
delete key; |
||||
} else { |
||||
add(key, val); |
||||
} |
||||
} |
||||
|
||||
void GHash::replace(GString *key, int val) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if ((p = find(key, &h))) { |
||||
p->val.i = val; |
||||
delete key; |
||||
} else { |
||||
add(key, val); |
||||
} |
||||
} |
||||
|
||||
void *GHash::lookup(GString *key) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return NULL; |
||||
} |
||||
return p->val.p; |
||||
} |
||||
|
||||
int GHash::lookupInt(GString *key) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return 0; |
||||
} |
||||
return p->val.i; |
||||
} |
||||
|
||||
void *GHash::lookup(char *key) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return NULL; |
||||
} |
||||
return p->val.p; |
||||
} |
||||
|
||||
int GHash::lookupInt(char *key) { |
||||
GHashBucket *p; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return 0; |
||||
} |
||||
return p->val.i; |
||||
} |
||||
|
||||
void *GHash::remove(GString *key) { |
||||
GHashBucket *p; |
||||
GHashBucket **q; |
||||
void *val; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return NULL; |
||||
} |
||||
q = &tab[h]; |
||||
while (*q != p) { |
||||
q = &((*q)->next); |
||||
} |
||||
*q = p->next; |
||||
if (deleteKeys) { |
||||
delete p->key; |
||||
} |
||||
val = p->val.p; |
||||
delete p; |
||||
--len; |
||||
return val; |
||||
} |
||||
|
||||
int GHash::removeInt(GString *key) { |
||||
GHashBucket *p; |
||||
GHashBucket **q; |
||||
int val; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return 0; |
||||
} |
||||
q = &tab[h]; |
||||
while (*q != p) { |
||||
q = &((*q)->next); |
||||
} |
||||
*q = p->next; |
||||
if (deleteKeys) { |
||||
delete p->key; |
||||
} |
||||
val = p->val.i; |
||||
delete p; |
||||
--len; |
||||
return val; |
||||
} |
||||
|
||||
void *GHash::remove(char *key) { |
||||
GHashBucket *p; |
||||
GHashBucket **q; |
||||
void *val; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return NULL; |
||||
} |
||||
q = &tab[h]; |
||||
while (*q != p) { |
||||
q = &((*q)->next); |
||||
} |
||||
*q = p->next; |
||||
if (deleteKeys) { |
||||
delete p->key; |
||||
} |
||||
val = p->val.p; |
||||
delete p; |
||||
--len; |
||||
return val; |
||||
} |
||||
|
||||
int GHash::removeInt(char *key) { |
||||
GHashBucket *p; |
||||
GHashBucket **q; |
||||
int val; |
||||
int h; |
||||
|
||||
if (!(p = find(key, &h))) { |
||||
return 0; |
||||
} |
||||
q = &tab[h]; |
||||
while (*q != p) { |
||||
q = &((*q)->next); |
||||
} |
||||
*q = p->next; |
||||
if (deleteKeys) { |
||||
delete p->key; |
||||
} |
||||
val = p->val.i; |
||||
delete p; |
||||
--len; |
||||
return val; |
||||
} |
||||
|
||||
void GHash::startIter(GHashIter **iter) { |
||||
*iter = new GHashIter; |
||||
(*iter)->h = -1; |
||||
(*iter)->p = NULL; |
||||
} |
||||
|
||||
GBool GHash::getNext(GHashIter **iter, GString **key, void **val) { |
||||
if (!*iter) { |
||||
return gFalse; |
||||
} |
||||
if ((*iter)->p) { |
||||
(*iter)->p = (*iter)->p->next; |
||||
} |
||||
while (!(*iter)->p) { |
||||
if (++(*iter)->h == size) { |
||||
delete *iter; |
||||
*iter = NULL; |
||||
return gFalse; |
||||
} |
||||
(*iter)->p = tab[(*iter)->h]; |
||||
} |
||||
*key = (*iter)->p->key; |
||||
*val = (*iter)->p->val.p; |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool GHash::getNext(GHashIter **iter, GString **key, int *val) { |
||||
if (!*iter) { |
||||
return gFalse; |
||||
} |
||||
if ((*iter)->p) { |
||||
(*iter)->p = (*iter)->p->next; |
||||
} |
||||
while (!(*iter)->p) { |
||||
if (++(*iter)->h == size) { |
||||
delete *iter; |
||||
*iter = NULL; |
||||
return gFalse; |
||||
} |
||||
(*iter)->p = tab[(*iter)->h]; |
||||
} |
||||
*key = (*iter)->p->key; |
||||
*val = (*iter)->p->val.i; |
||||
return gTrue; |
||||
} |
||||
|
||||
void GHash::killIter(GHashIter **iter) { |
||||
delete *iter; |
||||
*iter = NULL; |
||||
} |
||||
|
||||
void GHash::expand() { |
||||
GHashBucket **oldTab; |
||||
GHashBucket *p; |
||||
int oldSize, h, i; |
||||
|
||||
oldSize = size; |
||||
oldTab = tab; |
||||
size = 2*size + 1; |
||||
tab = (GHashBucket **)gmallocn(size, sizeof(GHashBucket *)); |
||||
for (h = 0; h < size; ++h) { |
||||
tab[h] = NULL; |
||||
} |
||||
for (i = 0; i < oldSize; ++i) { |
||||
while (oldTab[i]) { |
||||
p = oldTab[i]; |
||||
oldTab[i] = oldTab[i]->next; |
||||
h = hash(p->key); |
||||
p->next = tab[h]; |
||||
tab[h] = p; |
||||
} |
||||
} |
||||
gfree(oldTab); |
||||
} |
||||
|
||||
GHashBucket *GHash::find(GString *key, int *h) { |
||||
GHashBucket *p; |
||||
|
||||
*h = hash(key); |
||||
for (p = tab[*h]; p; p = p->next) { |
||||
if (!p->key->cmp(key)) { |
||||
return p; |
||||
} |
||||
} |
||||
return NULL; |
||||
} |
||||
|
||||
GHashBucket *GHash::find(char *key, int *h) { |
||||
GHashBucket *p; |
||||
|
||||
*h = hash(key); |
||||
for (p = tab[*h]; p; p = p->next) { |
||||
if (!p->key->cmp(key)) { |
||||
return p; |
||||
} |
||||
} |
||||
return NULL; |
||||
} |
||||
|
||||
int GHash::hash(GString *key) { |
||||
char *p; |
||||
unsigned int h; |
||||
int i; |
||||
|
||||
h = 0; |
||||
for (p = key->getCString(), i = 0; i < key->getLength(); ++p, ++i) { |
||||
h = 17 * h + (int)(*p & 0xff); |
||||
} |
||||
return (int)(h % size); |
||||
} |
||||
|
||||
int GHash::hash(char *key) { |
||||
char *p; |
||||
unsigned int h; |
||||
|
||||
h = 0; |
||||
for (p = key; *p; ++p) { |
||||
h = 17 * h + (int)(*p & 0xff); |
||||
} |
||||
return (int)(h % size); |
||||
} |
@ -1,78 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GHash.h
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GHASH_H |
||||
#define GHASH_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
|
||||
class GString; |
||||
struct GHashBucket; |
||||
struct GHashIter; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class GHash { |
||||
public: |
||||
|
||||
GHash(GBool deleteKeysA = gFalse); |
||||
~GHash(); |
||||
void add(GString *key, void *val); |
||||
void add(GString *key, int val); |
||||
void replace(GString *key, void *val); |
||||
void replace(GString *key, int val); |
||||
void *lookup(GString *key); |
||||
int lookupInt(GString *key); |
||||
void *lookup(char *key); |
||||
int lookupInt(char *key); |
||||
void *remove(GString *key); |
||||
int removeInt(GString *key); |
||||
void *remove(char *key); |
||||
int removeInt(char *key); |
||||
int getLength() { return len; } |
||||
void startIter(GHashIter **iter); |
||||
GBool getNext(GHashIter **iter, GString **key, void **val); |
||||
GBool getNext(GHashIter **iter, GString **key, int *val); |
||||
void killIter(GHashIter **iter); |
||||
|
||||
private: |
||||
|
||||
void expand(); |
||||
GHashBucket *find(GString *key, int *h); |
||||
GHashBucket *find(char *key, int *h); |
||||
int hash(GString *key); |
||||
int hash(char *key); |
||||
|
||||
GBool deleteKeys; // set if key strings should be deleted
|
||||
int size; // number of buckets
|
||||
int len; // number of entries
|
||||
GHashBucket **tab; |
||||
}; |
||||
|
||||
#define deleteGHash(hash, T) \ |
||||
do { \
|
||||
GHash *_hash = (hash); \
|
||||
{ \
|
||||
GHashIter *_iter; \
|
||||
GString *_key; \
|
||||
void *_p; \
|
||||
_hash->startIter(&_iter); \
|
||||
while (_hash->getNext(&_iter, &_key, &_p)) { \
|
||||
delete (T*)_p; \
|
||||
} \
|
||||
delete _hash; \
|
||||
} \
|
||||
} while(0) |
||||
|
||||
#endif |
@ -1,122 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GList.cc
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include "gmem.h" |
||||
#include "GList.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GList
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
GList::GList() { |
||||
size = 8; |
||||
data = (void **)gmallocn(size, sizeof(void*)); |
||||
length = 0; |
||||
inc = 0; |
||||
} |
||||
|
||||
GList::GList(int sizeA) { |
||||
size = sizeA ? sizeA : 8; |
||||
data = (void **)gmallocn(size, sizeof(void*)); |
||||
length = 0; |
||||
inc = 0; |
||||
} |
||||
|
||||
GList::~GList() { |
||||
gfree(data); |
||||
} |
||||
|
||||
GList *GList::copy() { |
||||
GList *ret; |
||||
|
||||
ret = new GList(length); |
||||
ret->length = length; |
||||
memcpy(ret->data, data, length * sizeof(void *)); |
||||
ret->inc = inc; |
||||
return ret; |
||||
} |
||||
|
||||
void GList::append(void *p) { |
||||
if (length >= size) { |
||||
expand(); |
||||
} |
||||
data[length++] = p; |
||||
} |
||||
|
||||
void GList::append(GList *list) { |
||||
int i; |
||||
|
||||
while (length + list->length > size) { |
||||
expand(); |
||||
} |
||||
for (i = 0; i < list->length; ++i) { |
||||
data[length++] = list->data[i]; |
||||
} |
||||
} |
||||
|
||||
void GList::insert(int i, void *p) { |
||||
if (length >= size) { |
||||
expand(); |
||||
} |
||||
if (i < 0) { |
||||
i = 0; |
||||
} |
||||
if (i < length) { |
||||
memmove(data+i+1, data+i, (length - i) * sizeof(void *)); |
||||
} |
||||
data[i] = p; |
||||
++length; |
||||
} |
||||
|
||||
void *GList::del(int i) { |
||||
void *p; |
||||
|
||||
p = data[i]; |
||||
if (i < length - 1) { |
||||
memmove(data+i, data+i+1, (length - i - 1) * sizeof(void *)); |
||||
} |
||||
--length; |
||||
if (size - length >= ((inc > 0) ? inc : size/2)) { |
||||
shrink(); |
||||
} |
||||
return p; |
||||
} |
||||
|
||||
void GList::sort(int (*cmp)(const void *obj1, const void *obj2)) { |
||||
qsort(data, length, sizeof(void *), cmp); |
||||
} |
||||
|
||||
void GList::reverse() { |
||||
void *t; |
||||
int n, i; |
||||
|
||||
n = length / 2; |
||||
for (i = 0; i < n; ++i) { |
||||
t = data[i]; |
||||
data[i] = data[length - 1 - i]; |
||||
data[length - 1 - i] = t; |
||||
} |
||||
} |
||||
|
||||
void GList::expand() { |
||||
size += (inc > 0) ? inc : size; |
||||
data = (void **)greallocn(data, size, sizeof(void*)); |
||||
} |
||||
|
||||
void GList::shrink() { |
||||
size -= (inc > 0) ? inc : size/2; |
||||
data = (void **)greallocn(data, size, sizeof(void*)); |
||||
} |
@ -1,106 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GList.h
|
||||
//
|
||||
// Copyright 2001-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GLIST_H |
||||
#define GLIST_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GList
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class GList { |
||||
public: |
||||
|
||||
// Create an empty list.
|
||||
GList(); |
||||
|
||||
// Create an empty list with space for <size1> elements.
|
||||
GList(int sizeA); |
||||
|
||||
// Destructor - does not free pointed-to objects.
|
||||
~GList(); |
||||
|
||||
//----- general
|
||||
|
||||
// Get the number of elements.
|
||||
int getLength() { return length; } |
||||
|
||||
// Returns a (shallow) copy of this list.
|
||||
GList *copy(); |
||||
|
||||
//----- ordered list support
|
||||
|
||||
// Return the <i>th element.
|
||||
// Assumes 0 <= i < length.
|
||||
void *get(int i) { return data[i]; } |
||||
|
||||
// Replace the <i>th element.
|
||||
// Assumes 0 <= i < length.
|
||||
void put(int i, void *p) { data[i] = p; } |
||||
|
||||
// Append an element to the end of the list.
|
||||
void append(void *p); |
||||
|
||||
// Append another list to the end of this one.
|
||||
void append(GList *list); |
||||
|
||||
// Insert an element at index <i>.
|
||||
// Assumes 0 <= i <= length.
|
||||
void insert(int i, void *p); |
||||
|
||||
// Deletes and returns the element at index <i>.
|
||||
// Assumes 0 <= i < length.
|
||||
void *del(int i); |
||||
|
||||
// Sort the list accoring to the given comparison function.
|
||||
// NB: this sorts an array of pointers, so the pointer args need to
|
||||
// be double-dereferenced.
|
||||
void sort(int (*cmp)(const void *ptr1, const void *ptr2)); |
||||
|
||||
// Reverse the list.
|
||||
void reverse(); |
||||
|
||||
//----- control
|
||||
|
||||
// Set allocation increment to <inc>. If inc > 0, that many
|
||||
// elements will be allocated every time the list is expanded.
|
||||
// If inc <= 0, the list will be doubled in size.
|
||||
void setAllocIncr(int incA) { inc = incA; } |
||||
|
||||
private: |
||||
|
||||
void expand(); |
||||
void shrink(); |
||||
|
||||
void **data; // the list elements
|
||||
int size; // size of data array
|
||||
int length; // number of elements on list
|
||||
int inc; // allocation increment
|
||||
}; |
||||
|
||||
#define deleteGList(list, T) \ |
||||
do { \
|
||||
GList *_list = (list); \
|
||||
{ \
|
||||
int _i; \
|
||||
for (_i = 0; _i < _list->getLength(); ++_i) { \
|
||||
delete (T*)_list->get(_i); \
|
||||
} \
|
||||
delete _list; \
|
||||
} \
|
||||
} while (0) |
||||
|
||||
#endif |
@ -1,49 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GMutex.h
|
||||
//
|
||||
// Portable mutex macros.
|
||||
//
|
||||
// Copyright 2002-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GMUTEX_H |
||||
#define GMUTEX_H |
||||
|
||||
// Usage:
|
||||
//
|
||||
// GMutex m;
|
||||
// gInitMutex(&m);
|
||||
// ...
|
||||
// gLockMutex(&m);
|
||||
// ... critical section ...
|
||||
// gUnlockMutex(&m);
|
||||
// ...
|
||||
// gDestroyMutex(&m);
|
||||
|
||||
#ifdef WIN32 |
||||
|
||||
#include <windows.h> |
||||
|
||||
typedef CRITICAL_SECTION GMutex; |
||||
|
||||
#define gInitMutex(m) InitializeCriticalSection(m) |
||||
#define gDestroyMutex(m) DeleteCriticalSection(m) |
||||
#define gLockMutex(m) EnterCriticalSection(m) |
||||
#define gUnlockMutex(m) LeaveCriticalSection(m) |
||||
|
||||
#else // assume pthreads
|
||||
|
||||
#include <pthread.h> |
||||
|
||||
typedef pthread_mutex_t GMutex; |
||||
|
||||
#define gInitMutex(m) pthread_mutex_init(m, NULL) |
||||
#define gDestroyMutex(m) pthread_mutex_destroy(m) |
||||
#define gLockMutex(m) pthread_mutex_lock(m) |
||||
#define gUnlockMutex(m) pthread_mutex_unlock(m) |
||||
|
||||
#endif |
||||
|
||||
#endif |
@ -1,722 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GString.cc
|
||||
//
|
||||
// Simple variable-length string type.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma implementation |
||||
#endif |
||||
|
||||
#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#include <string.h> |
||||
#include <ctype.h> |
||||
#include <math.h> |
||||
#include "gmem.h" |
||||
#include "GString.h" |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
union GStringFormatArg { |
||||
int i; |
||||
Guint ui; |
||||
long l; |
||||
Gulong ul; |
||||
double f; |
||||
char c; |
||||
char *s; |
||||
GString *gs; |
||||
}; |
||||
|
||||
enum GStringFormatType { |
||||
fmtIntDecimal, |
||||
fmtIntHex, |
||||
fmtIntOctal, |
||||
fmtIntBinary, |
||||
fmtUIntDecimal, |
||||
fmtUIntHex, |
||||
fmtUIntOctal, |
||||
fmtUIntBinary, |
||||
fmtLongDecimal, |
||||
fmtLongHex, |
||||
fmtLongOctal, |
||||
fmtLongBinary, |
||||
fmtULongDecimal, |
||||
fmtULongHex, |
||||
fmtULongOctal, |
||||
fmtULongBinary, |
||||
fmtDouble, |
||||
fmtDoubleTrim, |
||||
fmtChar, |
||||
fmtString, |
||||
fmtGString, |
||||
fmtSpace |
||||
}; |
||||
|
||||
static char *formatStrings[] = { |
||||
"d", "x", "o", "b", "ud", "ux", "uo", "ub", |
||||
"ld", "lx", "lo", "lb", "uld", "ulx", "ulo", "ulb", |
||||
"f", "g", |
||||
"c", |
||||
"s", |
||||
"t", |
||||
"w", |
||||
NULL |
||||
}; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
static inline int size(int len) { |
||||
int delta; |
||||
for (delta = 8; delta < len && delta < 0x100000; delta <<= 1) ; |
||||
// this is ((len + 1) + (delta - 1)) & ~(delta - 1)
|
||||
return (len + delta) & ~(delta - 1); |
||||
} |
||||
|
||||
inline void GString::resize(int length1) { |
||||
char *s1; |
||||
|
||||
if (!s) { |
||||
s = new char[size(length1)]; |
||||
} else if (size(length1) != size(length)) { |
||||
s1 = new char[size(length1)]; |
||||
if (length1 < length) { |
||||
memcpy(s1, s, length1); |
||||
s1[length1] = '\0'; |
||||
} else { |
||||
memcpy(s1, s, length + 1); |
||||
} |
||||
delete[] s; |
||||
s = s1; |
||||
} |
||||
} |
||||
|
||||
GString::GString() { |
||||
s = NULL; |
||||
resize(length = 0); |
||||
s[0] = '\0'; |
||||
} |
||||
|
||||
GString::GString(const char *sA) { |
||||
int n = strlen(sA); |
||||
|
||||
s = NULL; |
||||
resize(length = n); |
||||
memcpy(s, sA, n + 1); |
||||
} |
||||
|
||||
GString::GString(const char *sA, int lengthA) { |
||||
s = NULL; |
||||
resize(length = lengthA); |
||||
memcpy(s, sA, length * sizeof(char)); |
||||
s[length] = '\0'; |
||||
} |
||||
|
||||
GString::GString(GString *str, int idx, int lengthA) { |
||||
s = NULL; |
||||
resize(length = lengthA); |
||||
memcpy(s, str->getCString() + idx, length); |
||||
s[length] = '\0'; |
||||
} |
||||
|
||||
GString::GString(GString *str) { |
||||
s = NULL; |
||||
resize(length = str->getLength()); |
||||
memcpy(s, str->getCString(), length + 1); |
||||
} |
||||
|
||||
GString::GString(GString *str1, GString *str2) { |
||||
int n1 = str1->getLength(); |
||||
int n2 = str2->getLength(); |
||||
|
||||
s = NULL; |
||||
resize(length = n1 + n2); |
||||
memcpy(s, str1->getCString(), n1); |
||||
memcpy(s + n1, str2->getCString(), n2 + 1); |
||||
} |
||||
|
||||
GString *GString::fromInt(int x) { |
||||
char buf[24]; // enough space for 64-bit ints plus a little extra
|
||||
char *p; |
||||
int len; |
||||
|
||||
formatInt(x, buf, sizeof(buf), gFalse, 0, 10, &p, &len); |
||||
return new GString(p, len); |
||||
} |
||||
|
||||
GString *GString::format(const char *fmt, ...) { |
||||
va_list argList; |
||||
GString *s; |
||||
|
||||
s = new GString(); |
||||
va_start(argList, fmt); |
||||
s->appendfv(fmt, argList); |
||||
va_end(argList); |
||||
return s; |
||||
} |
||||
|
||||
GString *GString::formatv(const char *fmt, va_list argList) { |
||||
GString *s; |
||||
|
||||
s = new GString(); |
||||
s->appendfv(fmt, argList); |
||||
return s; |
||||
} |
||||
|
||||
GString::~GString() { |
||||
delete[] s; |
||||
} |
||||
|
||||
GString *GString::clear() { |
||||
s[length = 0] = '\0'; |
||||
resize(0); |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::append(char c) { |
||||
resize(length + 1); |
||||
s[length++] = c; |
||||
s[length] = '\0'; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::append(GString *str) { |
||||
int n = str->getLength(); |
||||
|
||||
resize(length + n); |
||||
memcpy(s + length, str->getCString(), n + 1); |
||||
length += n; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::append(const char *str) { |
||||
int n = strlen(str); |
||||
|
||||
resize(length + n); |
||||
memcpy(s + length, str, n + 1); |
||||
length += n; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::append(const char *str, int lengthA) { |
||||
resize(length + lengthA); |
||||
memcpy(s + length, str, lengthA); |
||||
length += lengthA; |
||||
s[length] = '\0'; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::appendf(const char *fmt, ...) { |
||||
va_list argList; |
||||
|
||||
va_start(argList, fmt); |
||||
appendfv(fmt, argList); |
||||
va_end(argList); |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::appendfv(const char *fmt, va_list argList) { |
||||
GStringFormatArg *args; |
||||
int argsLen, argsSize; |
||||
GStringFormatArg arg; |
||||
int idx, width, prec; |
||||
GBool reverseAlign, zeroFill; |
||||
GStringFormatType ft; |
||||
char buf[65]; |
||||
int len, i; |
||||
const char *p0, *p1; |
||||
char *str; |
||||
|
||||
argsLen = 0; |
||||
argsSize = 8; |
||||
args = (GStringFormatArg *)gmallocn(argsSize, sizeof(GStringFormatArg)); |
||||
|
||||
p0 = fmt; |
||||
while (*p0) { |
||||
if (*p0 == '{') { |
||||
++p0; |
||||
if (*p0 == '{') { |
||||
++p0; |
||||
append('{'); |
||||
} else { |
||||
|
||||
// parse the format string
|
||||
if (!(*p0 >= '0' && *p0 <= '9')) { |
||||
break; |
||||
} |
||||
idx = *p0 - '0'; |
||||
for (++p0; *p0 >= '0' && *p0 <= '9'; ++p0) { |
||||
idx = 10 * idx + (*p0 - '0'); |
||||
} |
||||
if (*p0 != ':') { |
||||
break; |
||||
} |
||||
++p0; |
||||
if (*p0 == '-') { |
||||
reverseAlign = gTrue; |
||||
++p0; |
||||
} else { |
||||
reverseAlign = gFalse; |
||||
} |
||||
width = 0; |
||||
zeroFill = *p0 == '0'; |
||||
for (; *p0 >= '0' && *p0 <= '9'; ++p0) { |
||||
width = 10 * width + (*p0 - '0'); |
||||
} |
||||
if (width < 0) { |
||||
width = 0; |
||||
} |
||||
if (*p0 == '.') { |
||||
++p0; |
||||
prec = 0; |
||||
for (; *p0 >= '0' && *p0 <= '9'; ++p0) { |
||||
prec = 10 * prec + (*p0 - '0'); |
||||
} |
||||
} else { |
||||
prec = 0; |
||||
} |
||||
for (ft = (GStringFormatType)0; |
||||
formatStrings[ft]; |
||||
ft = (GStringFormatType)(ft + 1)) { |
||||
if (!strncmp(p0, formatStrings[ft], strlen(formatStrings[ft]))) { |
||||
break; |
||||
} |
||||
} |
||||
if (!formatStrings[ft]) { |
||||
break; |
||||
} |
||||
p0 += strlen(formatStrings[ft]); |
||||
if (*p0 != '}') { |
||||
break; |
||||
} |
||||
++p0; |
||||
|
||||
// fetch the argument
|
||||
if (idx > argsLen) { |
||||
break; |
||||
} |
||||
if (idx == argsLen) { |
||||
if (argsLen == argsSize) { |
||||
argsSize *= 2; |
||||
args = (GStringFormatArg *)greallocn(args, argsSize, |
||||
sizeof(GStringFormatArg)); |
||||
} |
||||
switch (ft) { |
||||
case fmtIntDecimal: |
||||
case fmtIntHex: |
||||
case fmtIntOctal: |
||||
case fmtIntBinary: |
||||
case fmtSpace: |
||||
args[argsLen].i = va_arg(argList, int); |
||||
break; |
||||
case fmtUIntDecimal: |
||||
case fmtUIntHex: |
||||
case fmtUIntOctal: |
||||
case fmtUIntBinary: |
||||
args[argsLen].ui = va_arg(argList, Guint); |
||||
break; |
||||
case fmtLongDecimal: |
||||
case fmtLongHex: |
||||
case fmtLongOctal: |
||||
case fmtLongBinary: |
||||
args[argsLen].l = va_arg(argList, long); |
||||
break; |
||||
case fmtULongDecimal: |
||||
case fmtULongHex: |
||||
case fmtULongOctal: |
||||
case fmtULongBinary: |
||||
args[argsLen].ul = va_arg(argList, Gulong); |
||||
break; |
||||
case fmtDouble: |
||||
case fmtDoubleTrim: |
||||
args[argsLen].f = va_arg(argList, double); |
||||
break; |
||||
case fmtChar: |
||||
args[argsLen].c = (char)va_arg(argList, int); |
||||
break; |
||||
case fmtString: |
||||
args[argsLen].s = va_arg(argList, char *); |
||||
break; |
||||
case fmtGString: |
||||
args[argsLen].gs = va_arg(argList, GString *); |
||||
break; |
||||
} |
||||
++argsLen; |
||||
} |
||||
|
||||
// format the argument
|
||||
arg = args[idx]; |
||||
switch (ft) { |
||||
case fmtIntDecimal: |
||||
formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 10, &str, &len); |
||||
break; |
||||
case fmtIntHex: |
||||
formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 16, &str, &len); |
||||
break; |
||||
case fmtIntOctal: |
||||
formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 8, &str, &len); |
||||
break; |
||||
case fmtIntBinary: |
||||
formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 2, &str, &len); |
||||
break; |
||||
case fmtUIntDecimal: |
||||
formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 10, |
||||
&str, &len); |
||||
break; |
||||
case fmtUIntHex: |
||||
formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 16, |
||||
&str, &len); |
||||
break; |
||||
case fmtUIntOctal: |
||||
formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 8, &str, &len); |
||||
break; |
||||
case fmtUIntBinary: |
||||
formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 2, &str, &len); |
||||
break; |
||||
case fmtLongDecimal: |
||||
formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 10, &str, &len); |
||||
break; |
||||
case fmtLongHex: |
||||
formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 16, &str, &len); |
||||
break; |
||||
case fmtLongOctal: |
||||
formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 8, &str, &len); |
||||
break; |
||||
case fmtLongBinary: |
||||
formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 2, &str, &len); |
||||
break; |
||||
case fmtULongDecimal: |
||||
formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 10, |
||||
&str, &len); |
||||
break; |
||||
case fmtULongHex: |
||||
formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 16, |
||||
&str, &len); |
||||
break; |
||||
case fmtULongOctal: |
||||
formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 8, &str, &len); |
||||
break; |
||||
case fmtULongBinary: |
||||
formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 2, &str, &len); |
||||
break; |
||||
case fmtDouble: |
||||
formatDouble(arg.f, buf, sizeof(buf), prec, gFalse, &str, &len); |
||||
break; |
||||
case fmtDoubleTrim: |
||||
formatDouble(arg.f, buf, sizeof(buf), prec, gTrue, &str, &len); |
||||
break; |
||||
case fmtChar: |
||||
buf[0] = arg.c; |
||||
str = buf; |
||||
len = 1; |
||||
reverseAlign = !reverseAlign; |
||||
break; |
||||
case fmtString: |
||||
str = arg.s; |
||||
len = strlen(str); |
||||
reverseAlign = !reverseAlign; |
||||
break; |
||||
case fmtGString: |
||||
str = arg.gs->getCString(); |
||||
len = arg.gs->getLength(); |
||||
reverseAlign = !reverseAlign; |
||||
break; |
||||
case fmtSpace: |
||||
str = buf; |
||||
len = 0; |
||||
width = arg.i; |
||||
break; |
||||
} |
||||
|
||||
// append the formatted arg, handling width and alignment
|
||||
if (!reverseAlign && len < width) { |
||||
for (i = len; i < width; ++i) { |
||||
append(' '); |
||||
} |
||||
} |
||||
append(str, len); |
||||
if (reverseAlign && len < width) { |
||||
for (i = len; i < width; ++i) { |
||||
append(' '); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} else if (*p0 == '}') { |
||||
++p0; |
||||
if (*p0 == '}') { |
||||
++p0; |
||||
} |
||||
append('}'); |
||||
|
||||
} else { |
||||
for (p1 = p0 + 1; *p1 && *p1 != '{' && *p1 != '}'; ++p1) ; |
||||
append(p0, p1 - p0); |
||||
p0 = p1; |
||||
} |
||||
} |
||||
|
||||
gfree(args); |
||||
return this; |
||||
} |
||||
|
||||
void GString::formatInt(long x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len) { |
||||
static char vals[17] = "0123456789abcdef"; |
||||
GBool neg; |
||||
int start, i, j; |
||||
|
||||
i = bufSize; |
||||
if ((neg = x < 0)) { |
||||
x = -x; |
||||
} |
||||
start = neg ? 1 : 0; |
||||
if (x == 0) { |
||||
buf[--i] = '0'; |
||||
} else { |
||||
while (i > start && x) { |
||||
buf[--i] = vals[x % base]; |
||||
x /= base; |
||||
} |
||||
} |
||||
if (zeroFill) { |
||||
for (j = bufSize - i; i > start && j < width - start; ++j) { |
||||
buf[--i] = '0'; |
||||
} |
||||
} |
||||
if (neg) { |
||||
buf[--i] = '-'; |
||||
} |
||||
*p = buf + i; |
||||
*len = bufSize - i; |
||||
} |
||||
|
||||
void GString::formatUInt(Gulong x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len) { |
||||
static char vals[17] = "0123456789abcdef"; |
||||
int i, j; |
||||
|
||||
i = bufSize; |
||||
if (x == 0) { |
||||
buf[--i] = '0'; |
||||
} else { |
||||
while (i > 0 && x) { |
||||
buf[--i] = vals[x % base]; |
||||
x /= base; |
||||
} |
||||
} |
||||
if (zeroFill) { |
||||
for (j = bufSize - i; i > 0 && j < width; ++j) { |
||||
buf[--i] = '0'; |
||||
} |
||||
} |
||||
*p = buf + i; |
||||
*len = bufSize - i; |
||||
} |
||||
|
||||
void GString::formatDouble(double x, char *buf, int bufSize, int prec, |
||||
GBool trim, char **p, int *len) { |
||||
GBool neg, started; |
||||
double x2; |
||||
int d, i, j; |
||||
|
||||
if ((neg = x < 0)) { |
||||
x = -x; |
||||
} |
||||
x = floor(x * pow(10.0, prec) + 0.5); |
||||
i = bufSize; |
||||
started = !trim; |
||||
for (j = 0; j < prec && i > 1; ++j) { |
||||
x2 = floor(0.1 * (x + 0.5)); |
||||
d = (int)floor(x - 10 * x2 + 0.5); |
||||
if (started || d != 0) { |
||||
buf[--i] = '0' + d; |
||||
started = gTrue; |
||||
} |
||||
x = x2; |
||||
} |
||||
if (i > 1 && started) { |
||||
buf[--i] = '.'; |
||||
} |
||||
if (i > 1) { |
||||
do { |
||||
x2 = floor(0.1 * (x + 0.5)); |
||||
d = (int)floor(x - 10 * x2 + 0.5); |
||||
buf[--i] = '0' + d; |
||||
x = x2; |
||||
} while (i > 1 && x); |
||||
} |
||||
if (neg) { |
||||
buf[--i] = '-'; |
||||
} |
||||
*p = buf + i; |
||||
*len = bufSize - i; |
||||
} |
||||
|
||||
GString *GString::insert(int i, char c) { |
||||
int j; |
||||
|
||||
resize(length + 1); |
||||
for (j = length + 1; j > i; --j) |
||||
s[j] = s[j-1]; |
||||
s[i] = c; |
||||
++length; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::insert(int i, GString *str) { |
||||
int n = str->getLength(); |
||||
int j; |
||||
|
||||
resize(length + n); |
||||
for (j = length; j >= i; --j) |
||||
s[j+n] = s[j]; |
||||
memcpy(s+i, str->getCString(), n); |
||||
length += n; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::insert(int i, const char *str) { |
||||
int n = strlen(str); |
||||
int j; |
||||
|
||||
resize(length + n); |
||||
for (j = length; j >= i; --j) |
||||
s[j+n] = s[j]; |
||||
memcpy(s+i, str, n); |
||||
length += n; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::insert(int i, const char *str, int lengthA) { |
||||
int j; |
||||
|
||||
resize(length + lengthA); |
||||
for (j = length; j >= i; --j) |
||||
s[j+lengthA] = s[j]; |
||||
memcpy(s+i, str, lengthA); |
||||
length += lengthA; |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::del(int i, int n) { |
||||
int j; |
||||
|
||||
if (i >= 0 && n > 0 && i + n > 0) { |
||||
if (i + n > length) { |
||||
n = length - i; |
||||
} |
||||
for (j = i; j <= length - n; ++j) { |
||||
s[j] = s[j + n]; |
||||
} |
||||
resize(length -= n); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::upperCase() { |
||||
int i; |
||||
|
||||
for (i = 0; i < length; ++i) { |
||||
if (islower(s[i])) |
||||
s[i] = toupper(s[i]); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
GString *GString::lowerCase() { |
||||
int i; |
||||
|
||||
for (i = 0; i < length; ++i) { |
||||
if (isupper(s[i])) |
||||
s[i] = tolower(s[i]); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
int GString::cmp(GString *str) { |
||||
int n1, n2, i, x; |
||||
char *p1, *p2; |
||||
|
||||
n1 = length; |
||||
n2 = str->length; |
||||
for (i = 0, p1 = s, p2 = str->s; i < n1 && i < n2; ++i, ++p1, ++p2) { |
||||
x = *p1 - *p2; |
||||
if (x != 0) { |
||||
return x; |
||||
} |
||||
} |
||||
return n1 - n2; |
||||
} |
||||
|
||||
int GString::cmpN(GString *str, int n) { |
||||
int n1, n2, i, x; |
||||
char *p1, *p2; |
||||
|
||||
n1 = length; |
||||
n2 = str->length; |
||||
for (i = 0, p1 = s, p2 = str->s; |
||||
i < n1 && i < n2 && i < n; |
||||
++i, ++p1, ++p2) { |
||||
x = *p1 - *p2; |
||||
if (x != 0) { |
||||
return x; |
||||
} |
||||
} |
||||
if (i == n) { |
||||
return 0; |
||||
} |
||||
return n1 - n2; |
||||
} |
||||
|
||||
int GString::cmp(const char *sA) { |
||||
int n1, i, x; |
||||
const char *p1, *p2; |
||||
|
||||
n1 = length; |
||||
for (i = 0, p1 = s, p2 = sA; i < n1 && *p2; ++i, ++p1, ++p2) { |
||||
x = *p1 - *p2; |
||||
if (x != 0) { |
||||
return x; |
||||
} |
||||
} |
||||
if (i < n1) { |
||||
return 1; |
||||
} |
||||
if (*p2) { |
||||
return -1; |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
int GString::cmpN(const char *sA, int n) { |
||||
int n1, i, x; |
||||
const char *p1, *p2; |
||||
|
||||
n1 = length; |
||||
for (i = 0, p1 = s, p2 = sA; i < n1 && *p2 && i < n; ++i, ++p1, ++p2) { |
||||
x = *p1 - *p2; |
||||
if (x != 0) { |
||||
return x; |
||||
} |
||||
} |
||||
if (i == n) { |
||||
return 0; |
||||
} |
||||
if (i < n1) { |
||||
return 1; |
||||
} |
||||
if (*p2) { |
||||
return -1; |
||||
} |
||||
return 0; |
||||
} |
@ -1,136 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// GString.h
|
||||
//
|
||||
// Simple variable-length string type.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GSTRING_H |
||||
#define GSTRING_H |
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef USE_GCC_PRAGMAS |
||||
#pragma interface |
||||
#endif |
||||
|
||||
#include <stdarg.h> |
||||
#include "gtypes.h" |
||||
|
||||
class GString { |
||||
public: |
||||
|
||||
// Create an empty string.
|
||||
GString(); |
||||
|
||||
// Create a string from a C string.
|
||||
GString(const char *sA); |
||||
|
||||
// Create a string from <lengthA> chars at <sA>. This string
|
||||
// can contain null characters.
|
||||
GString(const char *sA, int lengthA); |
||||
|
||||
// Create a string from <lengthA> chars at <idx> in <str>.
|
||||
GString(GString *str, int idx, int lengthA); |
||||
|
||||
// Copy a string.
|
||||
GString(GString *str); |
||||
GString *copy() { return new GString(this); } |
||||
|
||||
// Concatenate two strings.
|
||||
GString(GString *str1, GString *str2); |
||||
|
||||
// Convert an integer to a string.
|
||||
static GString *fromInt(int x); |
||||
|
||||
// Create a formatted string. Similar to printf, but without the
|
||||
// string overflow issues. Formatting elements consist of:
|
||||
// {<arg>:[<width>][.<precision>]<type>}
|
||||
// where:
|
||||
// - <arg> is the argument number (arg 0 is the first argument
|
||||
// following the format string) -- NB: args must be first used in
|
||||
// order; they can be reused in any order
|
||||
// - <width> is the field width -- negative to reverse the alignment;
|
||||
// starting with a leading zero to zero-fill (for integers)
|
||||
// - <precision> is the number of digits to the right of the decimal
|
||||
// point (for floating point numbers)
|
||||
// - <type> is one of:
|
||||
// d, x, o, b -- int in decimal, hex, octal, binary
|
||||
// ud, ux, uo, ub -- unsigned int
|
||||
// ld, lx, lo, lb, uld, ulx, ulo, ulb -- long, unsigned long
|
||||
// f, g -- double
|
||||
// c -- char
|
||||
// s -- string (char *)
|
||||
// t -- GString *
|
||||
// w -- blank space; arg determines width
|
||||
// To get literal curly braces, use {{ or }}.
|
||||
static GString *format(const char *fmt, ...); |
||||
static GString *formatv(const char *fmt, va_list argList); |
||||
|
||||
// Destructor.
|
||||
~GString(); |
||||
|
||||
// Get length.
|
||||
int getLength() { return length; } |
||||
|
||||
// Get C string.
|
||||
char *getCString() { return s; } |
||||
|
||||
// Get <i>th character.
|
||||
char getChar(int i) { return s[i]; } |
||||
|
||||
// Change <i>th character.
|
||||
void setChar(int i, char c) { s[i] = c; } |
||||
|
||||
// Clear string to zero length.
|
||||
GString *clear(); |
||||
|
||||
// Append a character or string.
|
||||
GString *append(char c); |
||||
GString *append(GString *str); |
||||
GString *append(const char *str); |
||||
GString *append(const char *str, int lengthA); |
||||
|
||||
// Append a formatted string.
|
||||
GString *appendf(const char *fmt, ...); |
||||
GString *appendfv(const char *fmt, va_list argList); |
||||
|
||||
// Insert a character or string.
|
||||
GString *insert(int i, char c); |
||||
GString *insert(int i, GString *str); |
||||
GString *insert(int i, const char *str); |
||||
GString *insert(int i, const char *str, int lengthA); |
||||
|
||||
// Delete a character or range of characters.
|
||||
GString *del(int i, int n = 1); |
||||
|
||||
// Convert string to all-upper/all-lower case.
|
||||
GString *upperCase(); |
||||
GString *lowerCase(); |
||||
|
||||
// Compare two strings: -1:< 0:= +1:>
|
||||
int cmp(GString *str); |
||||
int cmpN(GString *str, int n); |
||||
int cmp(const char *sA); |
||||
int cmpN(const char *sA, int n); |
||||
|
||||
private: |
||||
|
||||
int length; |
||||
char *s; |
||||
|
||||
void resize(int length1); |
||||
static void formatInt(long x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len); |
||||
static void formatUInt(Gulong x, char *buf, int bufSize, |
||||
GBool zeroFill, int width, int base, |
||||
char **p, int *len); |
||||
static void formatDouble(double x, char *buf, int bufSize, int prec, |
||||
GBool trim, char **p, int *len); |
||||
}; |
||||
|
||||
#endif |
@ -1,71 +0,0 @@ |
||||
#========================================================================
|
||||
#
|
||||
# Goo library Makefile
|
||||
#
|
||||
# Copyright 1996-2003 Glyph & Cog, LLC
|
||||
#
|
||||
#========================================================================
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CFLAGS = @CFLAGS@ @DEFS@ -I.. -I$(srcdir)
|
||||
CXXFLAGS = @CXXFLAGS@ @DEFS@ -I.. -I$(srcdir)
|
||||
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
LIBPREFIX = @LIBPREFIX@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
.SUFFIXES: .cc |
||||
|
||||
.cc.o: |
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
CXX_SRC = \
|
||||
$(srcdir)/GHash.cc \
|
||||
$(srcdir)/GList.cc \
|
||||
$(srcdir)/GString.cc \
|
||||
$(srcdir)/gmem.cc \
|
||||
$(srcdir)/gmempp.cc \
|
||||
$(srcdir)/gfile.cc \
|
||||
$(srcdir)/FixedPoint.cc
|
||||
|
||||
C_SRC = \
|
||||
$(srcdir)/parseargs.c
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
all: $(LIBPREFIX)Goo.a |
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
GOO_CXX_OBJS = GHash.o GList.o GString.o gmem.o gmempp.o gfile.o FixedPoint.o
|
||||
GOO_C_OBJS = parseargs.o
|
||||
GOO_OBJS = $(GOO_CXX_OBJS) $(GOO_C_OBJS)
|
||||
|
||||
$(LIBPREFIX)Goo.a: $(GOO_OBJS) |
||||
rm -f $(LIBPREFIX)Goo.a
|
||||
$(AR) $(LIBPREFIX)Goo.a $(GOO_OBJS)
|
||||
$(RANLIB) $(LIBPREFIX)Goo.a
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
clean: |
||||
rm -f $(GOO_OBJS) $(LIBPREFIX)Goo.a
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
depend: |
||||
$(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >Makefile.dep
|
||||
$(CC) $(CFLAGS) -MM $(C_SRC) >>Makefile.dep
|
||||
|
||||
include Makefile.dep |
@ -1,834 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// gfile.cc
|
||||
//
|
||||
// Miscellaneous file and directory name manipulation.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
|
||||
#ifdef WIN32 |
||||
# include <time.h> |
||||
#else |
||||
# if defined(MACOS) |
||||
# include <sys/stat.h> |
||||
# elif !defined(ACORN) |
||||
# include <sys/types.h> |
||||
# include <sys/stat.h> |
||||
# include <fcntl.h> |
||||
# endif |
||||
# include <time.h> |
||||
# include <limits.h> |
||||
# include <string.h> |
||||
# if !defined(VMS) && !defined(ACORN) && !defined(MACOS) |
||||
# include <pwd.h> |
||||
# endif |
||||
# if defined(VMS) && (__DECCXX_VER < 50200000) |
||||
# include <unixlib.h> |
||||
# endif |
||||
#endif // WIN32
|
||||
#include "GString.h" |
||||
#include "gfile.h" |
||||
|
||||
// Some systems don't define this, so just make it something reasonably
|
||||
// large.
|
||||
#ifndef PATH_MAX |
||||
#define PATH_MAX 1024 |
||||
#endif |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
GString *getHomeDir() { |
||||
#ifdef VMS |
||||
//---------- VMS ----------
|
||||
return new GString("SYS$LOGIN:"); |
||||
|
||||
#elif defined(__EMX__) || defined(WIN32) |
||||
//---------- OS/2+EMX and Win32 ----------
|
||||
char *s; |
||||
GString *ret; |
||||
|
||||
if ((s = getenv("HOME"))) |
||||
ret = new GString(s); |
||||
else |
||||
ret = new GString("."); |
||||
return ret; |
||||
|
||||
#elif defined(ACORN) |
||||
//---------- RISCOS ----------
|
||||
return new GString("@"); |
||||
|
||||
#elif defined(MACOS) |
||||
//---------- MacOS ----------
|
||||
return new GString(":"); |
||||
|
||||
#else |
||||
//---------- Unix ----------
|
||||
char *s; |
||||
struct passwd *pw; |
||||
GString *ret; |
||||
|
||||
if ((s = getenv("HOME"))) { |
||||
ret = new GString(s); |
||||
} else { |
||||
if ((s = getenv("USER"))) |
||||
pw = getpwnam(s); |
||||
else |
||||
pw = getpwuid(getuid()); |
||||
if (pw) |
||||
ret = new GString(pw->pw_dir); |
||||
else |
||||
ret = new GString("."); |
||||
} |
||||
return ret; |
||||
#endif |
||||
} |
||||
|
||||
GString *getCurrentDir() { |
||||
char buf[PATH_MAX+1]; |
||||
|
||||
#if defined(__EMX__) |
||||
if (_getcwd2(buf, sizeof(buf))) |
||||
#elif defined(WIN32) |
||||
if (GetCurrentDirectory(sizeof(buf), buf)) |
||||
#elif defined(ACORN) |
||||
if (strcpy(buf, "@")) |
||||
#elif defined(MACOS) |
||||
if (strcpy(buf, ":")) |
||||
#else |
||||
if (getcwd(buf, sizeof(buf))) |
||||
#endif |
||||
return new GString(buf); |
||||
return new GString(); |
||||
} |
||||
|
||||
GString *appendToPath(GString *path, char *fileName) { |
||||
#if defined(VMS) |
||||
//---------- VMS ----------
|
||||
//~ this should handle everything necessary for file
|
||||
//~ requesters, but it's certainly not complete
|
||||
char *p0, *p1, *p2; |
||||
char *q1; |
||||
|
||||
p0 = path->getCString(); |
||||
p1 = p0 + path->getLength() - 1; |
||||
if (!strcmp(fileName, "-")) { |
||||
if (*p1 == ']') { |
||||
for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ; |
||||
if (*p2 == '[') |
||||
++p2; |
||||
path->del(p2 - p0, p1 - p2); |
||||
} else if (*p1 == ':') { |
||||
path->append("[-]"); |
||||
} else { |
||||
path->clear(); |
||||
path->append("[-]"); |
||||
} |
||||
} else if ((q1 = strrchr(fileName, '.')) && !strncmp(q1, ".DIR;", 5)) { |
||||
if (*p1 == ']') { |
||||
path->insert(p1 - p0, '.'); |
||||
path->insert(p1 - p0 + 1, fileName, q1 - fileName); |
||||
} else if (*p1 == ':') { |
||||
path->append('['); |
||||
path->append(']'); |
||||
path->append(fileName, q1 - fileName); |
||||
} else { |
||||
path->clear(); |
||||
path->append(fileName, q1 - fileName); |
||||
} |
||||
} else { |
||||
if (*p1 != ']' && *p1 != ':') |
||||
path->clear(); |
||||
path->append(fileName); |
||||
} |
||||
return path; |
||||
|
||||
#elif defined(WIN32) |
||||
//---------- Win32 ----------
|
||||
GString *tmp; |
||||
char buf[256]; |
||||
char *fp; |
||||
|
||||
tmp = new GString(path); |
||||
tmp->append('/'); |
||||
tmp->append(fileName); |
||||
GetFullPathName(tmp->getCString(), sizeof(buf), buf, &fp); |
||||
delete tmp; |
||||
path->clear(); |
||||
path->append(buf); |
||||
return path; |
||||
|
||||
#elif defined(ACORN) |
||||
//---------- RISCOS ----------
|
||||
char *p; |
||||
int i; |
||||
|
||||
path->append("."); |
||||
i = path->getLength(); |
||||
path->append(fileName); |
||||
for (p = path->getCString() + i; *p; ++p) { |
||||
if (*p == '/') { |
||||
*p = '.'; |
||||
} else if (*p == '.') { |
||||
*p = '/'; |
||||
} |
||||
} |
||||
return path; |
||||
|
||||
#elif defined(MACOS) |
||||
//---------- MacOS ----------
|
||||
char *p; |
||||
int i; |
||||
|
||||
path->append(":"); |
||||
i = path->getLength(); |
||||
path->append(fileName); |
||||
for (p = path->getCString() + i; *p; ++p) { |
||||
if (*p == '/') { |
||||
*p = ':'; |
||||
} else if (*p == '.') { |
||||
*p = ':'; |
||||
} |
||||
} |
||||
return path; |
||||
|
||||
#elif defined(__EMX__) |
||||
//---------- OS/2+EMX ----------
|
||||
int i; |
||||
|
||||
// appending "." does nothing
|
||||
if (!strcmp(fileName, ".")) |
||||
return path; |
||||
|
||||
// appending ".." goes up one directory
|
||||
if (!strcmp(fileName, "..")) { |
||||
for (i = path->getLength() - 2; i >= 0; --i) { |
||||
if (path->getChar(i) == '/' || path->getChar(i) == '\\' || |
||||
path->getChar(i) == ':') |
||||
break; |
||||
} |
||||
if (i <= 0) { |
||||
if (path->getChar(0) == '/' || path->getChar(0) == '\\') { |
||||
path->del(1, path->getLength() - 1); |
||||
} else if (path->getLength() >= 2 && path->getChar(1) == ':') { |
||||
path->del(2, path->getLength() - 2); |
||||
} else { |
||||
path->clear(); |
||||
path->append(".."); |
||||
} |
||||
} else { |
||||
if (path->getChar(i-1) == ':') |
||||
++i; |
||||
path->del(i, path->getLength() - i); |
||||
} |
||||
return path; |
||||
} |
||||
|
||||
// otherwise, append "/" and new path component
|
||||
if (path->getLength() > 0 && |
||||
path->getChar(path->getLength() - 1) != '/' && |
||||
path->getChar(path->getLength() - 1) != '\\') |
||||
path->append('/'); |
||||
path->append(fileName); |
||||
return path; |
||||
|
||||
#else |
||||
//---------- Unix ----------
|
||||
int i; |
||||
|
||||
// appending "." does nothing
|
||||
if (!strcmp(fileName, ".")) |
||||
return path; |
||||
|
||||
// appending ".." goes up one directory
|
||||
if (!strcmp(fileName, "..")) { |
||||
for (i = path->getLength() - 2; i >= 0; --i) { |
||||
if (path->getChar(i) == '/') |
||||
break; |
||||
} |
||||
if (i <= 0) { |
||||
if (path->getChar(0) == '/') { |
||||
path->del(1, path->getLength() - 1); |
||||
} else { |
||||
path->clear(); |
||||
path->append(".."); |
||||
} |
||||
} else { |
||||
path->del(i, path->getLength() - i); |
||||
} |
||||
return path; |
||||
} |
||||
|
||||
// otherwise, append "/" and new path component
|
||||
if (path->getLength() > 0 && |
||||
path->getChar(path->getLength() - 1) != '/') |
||||
path->append('/'); |
||||
path->append(fileName); |
||||
return path; |
||||
#endif |
||||
} |
||||
|
||||
GString *grabPath(char *fileName) { |
||||
#ifdef VMS |
||||
//---------- VMS ----------
|
||||
char *p; |
||||
|
||||
if ((p = strrchr(fileName, ']'))) |
||||
return new GString(fileName, p + 1 - fileName); |
||||
if ((p = strrchr(fileName, ':'))) |
||||
return new GString(fileName, p + 1 - fileName); |
||||
return new GString(); |
||||
|
||||
#elif defined(__EMX__) || defined(WIN32) |
||||
//---------- OS/2+EMX and Win32 ----------
|
||||
char *p; |
||||
|
||||
if ((p = strrchr(fileName, '/'))) |
||||
return new GString(fileName, p - fileName); |
||||
if ((p = strrchr(fileName, '\\'))) |
||||
return new GString(fileName, p - fileName); |
||||
if ((p = strrchr(fileName, ':'))) |
||||
return new GString(fileName, p + 1 - fileName); |
||||
return new GString(); |
||||
|
||||
#elif defined(ACORN) |
||||
//---------- RISCOS ----------
|
||||
char *p; |
||||
|
||||
if ((p = strrchr(fileName, '.'))) |
||||
return new GString(fileName, p - fileName); |
||||
return new GString(); |
||||
|
||||
#elif defined(MACOS) |
||||
//---------- MacOS ----------
|
||||
char *p; |
||||
|
||||
if ((p = strrchr(fileName, ':'))) |
||||
return new GString(fileName, p - fileName); |
||||
return new GString(); |
||||
|
||||
#else |
||||
//---------- Unix ----------
|
||||
char *p; |
||||
|
||||
if ((p = strrchr(fileName, '/'))) |
||||
return new GString(fileName, p - fileName); |
||||
return new GString(); |
||||
#endif |
||||
} |
||||
|
||||
GBool isAbsolutePath(char *path) { |
||||
#ifdef VMS |
||||
//---------- VMS ----------
|
||||
return strchr(path, ':') || |
||||
(path[0] == '[' && path[1] != '.' && path[1] != '-'); |
||||
|
||||
#elif defined(__EMX__) || defined(WIN32) |
||||
//---------- OS/2+EMX and Win32 ----------
|
||||
return path[0] == '/' || path[0] == '\\' || path[1] == ':'; |
||||
|
||||
#elif defined(ACORN) |
||||
//---------- RISCOS ----------
|
||||
return path[0] == '$'; |
||||
|
||||
#elif defined(MACOS) |
||||
//---------- MacOS ----------
|
||||
return path[0] != ':'; |
||||
|
||||
#else |
||||
//---------- Unix ----------
|
||||
return path[0] == '/'; |
||||
#endif |
||||
} |
||||
|
||||
GString *makePathAbsolute(GString *path) { |
||||
#ifdef VMS |
||||
//---------- VMS ----------
|
||||
char buf[PATH_MAX+1]; |
||||
|
||||
if (!isAbsolutePath(path->getCString())) { |
||||
if (getcwd(buf, sizeof(buf))) { |
||||
path->insert(0, buf); |
||||
} |
||||
} |
||||
return path; |
||||
|
||||
#elif defined(WIN32) |
||||
//---------- Win32 ----------
|
||||
char buf[_MAX_PATH]; |
||||
char *fp; |
||||
|
||||
buf[0] = '\0'; |
||||
if (!GetFullPathName(path->getCString(), _MAX_PATH, buf, &fp)) { |
||||
path->clear(); |
||||
return path; |
||||
} |
||||
path->clear(); |
||||
path->append(buf); |
||||
return path; |
||||
|
||||
#elif defined(ACORN) |
||||
//---------- RISCOS ----------
|
||||
path->insert(0, '@'); |
||||
return path; |
||||
|
||||
#elif defined(MACOS) |
||||
//---------- MacOS ----------
|
||||
path->del(0, 1); |
||||
return path; |
||||
|
||||
#else |
||||
//---------- Unix and OS/2+EMX ----------
|
||||
struct passwd *pw; |
||||
char buf[PATH_MAX+1]; |
||||
GString *s; |
||||
char *p1, *p2; |
||||
int n; |
||||
|
||||
if (path->getChar(0) == '~') { |
||||
if (path->getChar(1) == '/' || |
||||
#ifdef __EMX__ |
||||
path->getChar(1) == '\\' || |
||||
#endif |
||||
path->getLength() == 1) { |
||||
path->del(0, 1); |
||||
s = getHomeDir(); |
||||
path->insert(0, s); |
||||
delete s; |
||||
} else { |
||||
p1 = path->getCString() + 1; |
||||
#ifdef __EMX__ |
||||
for (p2 = p1; *p2 && *p2 != '/' && *p2 != '\\'; ++p2) ; |
||||
#else |
||||
for (p2 = p1; *p2 && *p2 != '/'; ++p2) ; |
||||
#endif |
||||
if ((n = p2 - p1) > PATH_MAX) |
||||
n = PATH_MAX; |
||||
strncpy(buf, p1, n); |
||||
buf[n] = '\0'; |
||||
if ((pw = getpwnam(buf))) { |
||||
path->del(0, p2 - p1 + 1); |
||||
path->insert(0, pw->pw_dir); |
||||
} |
||||
} |
||||
} else if (!isAbsolutePath(path->getCString())) { |
||||
if (getcwd(buf, sizeof(buf))) { |
||||
#ifndef __EMX__ |
||||
path->insert(0, '/'); |
||||
#endif |
||||
path->insert(0, buf); |
||||
} |
||||
} |
||||
return path; |
||||
#endif |
||||
} |
||||
|
||||
time_t getModTime(char *fileName) { |
||||
#ifdef WIN32 |
||||
//~ should implement this, but it's (currently) only used in xpdf
|
||||
return 0; |
||||
#else |
||||
struct stat statBuf; |
||||
|
||||
if (stat(fileName, &statBuf)) { |
||||
return 0; |
||||
} |
||||
return statBuf.st_mtime; |
||||
#endif |
||||
} |
||||
|
||||
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) { |
||||
#if defined(WIN32) |
||||
//---------- Win32 ----------
|
||||
char *tempDir; |
||||
GString *s, *s2; |
||||
FILE *f2; |
||||
int t, i; |
||||
|
||||
// this has the standard race condition problem, but I haven't found
|
||||
// a better way to generate temp file names with extensions on
|
||||
// Windows
|
||||
if ((tempDir = getenv("TEMP"))) { |
||||
s = new GString(tempDir); |
||||
s->append('\\'); |
||||
} else { |
||||
s = new GString(); |
||||
} |
||||
s->appendf("x_{0:d}_{1:d}_", |
||||
(int)GetCurrentProcessId(), (int)GetCurrentThreadId()); |
||||
t = (int)time(NULL); |
||||
for (i = 0; i < 1000; ++i) { |
||||
s2 = s->copy()->appendf("{0:d}", t + i); |
||||
if (ext) { |
||||
s2->append(ext); |
||||
} |
||||
if (!(f2 = fopen(s2->getCString(), "r"))) { |
||||
if (!(f2 = fopen(s2->getCString(), mode))) { |
||||
delete s2; |
||||
delete s; |
||||
return gFalse; |
||||
} |
||||
*name = s2; |
||||
*f = f2; |
||||
delete s; |
||||
return gTrue; |
||||
} |
||||
fclose(f2); |
||||
delete s2; |
||||
} |
||||
delete s; |
||||
return gFalse; |
||||
#elif defined(VMS) || defined(__EMX__) || defined(ACORN) || defined(MACOS) |
||||
//---------- non-Unix ----------
|
||||
char *s; |
||||
|
||||
// There is a security hole here: an attacker can create a symlink
|
||||
// with this file name after the tmpnam call and before the fopen
|
||||
// call. I will happily accept fixes to this function for non-Unix
|
||||
// OSs.
|
||||
if (!(s = tmpnam(NULL))) { |
||||
return gFalse; |
||||
} |
||||
*name = new GString(s); |
||||
if (ext) { |
||||
(*name)->append(ext); |
||||
} |
||||
if (!(*f = fopen((*name)->getCString(), mode))) { |
||||
delete (*name); |
||||
*name = NULL; |
||||
return gFalse; |
||||
} |
||||
return gTrue; |
||||
#else |
||||
//---------- Unix ----------
|
||||
char *s; |
||||
int fd; |
||||
|
||||
if (ext) { |
||||
#if HAVE_MKSTEMPS |
||||
if ((s = getenv("TMPDIR"))) { |
||||
*name = new GString(s); |
||||
} else { |
||||
*name = new GString("/tmp"); |
||||
} |
||||
(*name)->append("/XXXXXX")->append(ext); |
||||
fd = mkstemps((*name)->getCString(), strlen(ext)); |
||||
#else |
||||
if (!(s = tmpnam(NULL))) { |
||||
return gFalse; |
||||
} |
||||
*name = new GString(s); |
||||
(*name)->append(ext); |
||||
fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); |
||||
#endif |
||||
} else { |
||||
#if HAVE_MKSTEMP |
||||
if ((s = getenv("TMPDIR"))) { |
||||
*name = new GString(s); |
||||
} else { |
||||
*name = new GString("/tmp"); |
||||
} |
||||
(*name)->append("/XXXXXX"); |
||||
fd = mkstemp((*name)->getCString()); |
||||
#else // HAVE_MKSTEMP
|
||||
if (!(s = tmpnam(NULL))) { |
||||
return gFalse; |
||||
} |
||||
*name = new GString(s); |
||||
fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); |
||||
#endif // HAVE_MKSTEMP
|
||||
} |
||||
if (fd < 0 || !(*f = fdopen(fd, mode))) { |
||||
delete *name; |
||||
*name = NULL; |
||||
return gFalse; |
||||
} |
||||
return gTrue; |
||||
#endif |
||||
} |
||||
|
||||
GBool executeCommand(char *cmd) { |
||||
#ifdef VMS |
||||
return system(cmd) ? gTrue : gFalse; |
||||
#else |
||||
return system(cmd) ? gFalse : gTrue; |
||||
#endif |
||||
} |
||||
|
||||
#ifdef WIN32 |
||||
GString *fileNameToUTF8(char *path) { |
||||
GString *s; |
||||
char *p; |
||||
|
||||
s = new GString(); |
||||
for (p = path; *p; ++p) { |
||||
if (*p & 0x80) { |
||||
s->append((char)(0xc0 | ((*p >> 6) & 0x03))); |
||||
s->append((char)(0x80 | (*p & 0x3f))); |
||||
} else { |
||||
s->append(*p); |
||||
} |
||||
} |
||||
return s; |
||||
} |
||||
|
||||
GString *fileNameToUTF8(wchar_t *path) { |
||||
GString *s; |
||||
wchar_t *p; |
||||
|
||||
s = new GString(); |
||||
for (p = path; *p; ++p) { |
||||
if (*p < 0x80) { |
||||
s->append((char)*p); |
||||
} else if (*p < 0x800) { |
||||
s->append((char)(0xc0 | ((*p >> 6) & 0x1f))); |
||||
s->append((char)(0x80 | (*p & 0x3f))); |
||||
} else { |
||||
s->append((char)(0xe0 | ((*p >> 12) & 0x0f))); |
||||
s->append((char)(0x80 | ((*p >> 6) & 0x3f))); |
||||
s->append((char)(0x80 | (*p & 0x3f))); |
||||
} |
||||
} |
||||
return s; |
||||
} |
||||
#endif |
||||
|
||||
FILE *openFile(const char *path, const char *mode) { |
||||
#ifdef WIN32 |
||||
OSVERSIONINFO version; |
||||
wchar_t wPath[_MAX_PATH + 1]; |
||||
char nPath[_MAX_PATH + 1]; |
||||
wchar_t wMode[8]; |
||||
const char *p; |
||||
int i; |
||||
|
||||
// NB: _wfopen is only available in NT
|
||||
version.dwOSVersionInfoSize = sizeof(version); |
||||
GetVersionEx(&version); |
||||
if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { |
||||
for (p = path, i = 0; *p && i < _MAX_PATH; ++i) { |
||||
if ((p[0] & 0xe0) == 0xc0 && |
||||
p[1] && (p[1] & 0xc0) == 0x80) { |
||||
wPath[i] = (wchar_t)(((p[0] & 0x1f) << 6) | |
||||
(p[1] & 0x3f)); |
||||
p += 2; |
||||
} else if ((p[0] & 0xf0) == 0xe0 && |
||||
p[1] && (p[1] & 0xc0) == 0x80 && |
||||
p[2] && (p[2] & 0xc0) == 0x80) { |
||||
wPath[i] = (wchar_t)(((p[0] & 0x0f) << 12) | |
||||
((p[1] & 0x3f) << 6) | |
||||
(p[2] & 0x3f)); |
||||
p += 3; |
||||
} else { |
||||
wPath[i] = (wchar_t)(p[0] & 0xff); |
||||
p += 1; |
||||
} |
||||
} |
||||
wPath[i] = (wchar_t)0; |
||||
for (i = 0; mode[i] && i < sizeof(mode) - 1; ++i) { |
||||
wMode[i] = (wchar_t)(mode[i] & 0xff); |
||||
} |
||||
wMode[i] = (wchar_t)0; |
||||
return _wfopen(wPath, wMode); |
||||
} else { |
||||
for (p = path, i = 0; *p && i < _MAX_PATH; ++i) { |
||||
if ((p[0] & 0xe0) == 0xc0 && |
||||
p[1] && (p[1] & 0xc0) == 0x80) { |
||||
nPath[i] = (char)(((p[0] & 0x1f) << 6) | |
||||
(p[1] & 0x3f)); |
||||
p += 2; |
||||
} else if ((p[0] & 0xf0) == 0xe0 && |
||||
p[1] && (p[1] & 0xc0) == 0x80 && |
||||
p[2] && (p[2] & 0xc0) == 0x80) { |
||||
nPath[i] = (char)(((p[1] & 0x3f) << 6) | |
||||
(p[2] & 0x3f)); |
||||
p += 3; |
||||
} else { |
||||
nPath[i] = p[0]; |
||||
p += 1; |
||||
} |
||||
} |
||||
nPath[i] = '\0'; |
||||
return fopen(nPath, mode); |
||||
} |
||||
#else |
||||
return fopen(path, mode); |
||||
#endif |
||||
} |
||||
|
||||
char *getLine(char *buf, int size, FILE *f) { |
||||
int c, i; |
||||
|
||||
i = 0; |
||||
while (i < size - 1) { |
||||
if ((c = fgetc(f)) == EOF) { |
||||
break; |
||||
} |
||||
buf[i++] = (char)c; |
||||
if (c == '\x0a') { |
||||
break; |
||||
} |
||||
if (c == '\x0d') { |
||||
c = fgetc(f); |
||||
if (c == '\x0a' && i < size - 1) { |
||||
buf[i++] = (char)c; |
||||
} else if (c != EOF) { |
||||
ungetc(c, f); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
buf[i] = '\0'; |
||||
if (i == 0) { |
||||
return NULL; |
||||
} |
||||
return buf; |
||||
} |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GDir and GDirEntry
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) { |
||||
#ifdef VMS |
||||
char *p; |
||||
#elif defined(WIN32) |
||||
int fa; |
||||
GString *s; |
||||
#elif defined(ACORN) |
||||
#else |
||||
struct stat st; |
||||
GString *s; |
||||
#endif |
||||
|
||||
name = new GString(nameA); |
||||
dir = gFalse; |
||||
if (doStat) { |
||||
#ifdef VMS |
||||
if (!strcmp(nameA, "-") || |
||||
((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5))) |
||||
dir = gTrue; |
||||
#elif defined(ACORN) |
||||
#else |
||||
s = new GString(dirPath); |
||||
appendToPath(s, nameA); |
||||
#ifdef WIN32 |
||||
fa = GetFileAttributes(s->getCString()); |
||||
dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); |
||||
#else |
||||
if (stat(s->getCString(), &st) == 0) |
||||
dir = S_ISDIR(st.st_mode); |
||||
#endif |
||||
delete s; |
||||
#endif |
||||
} |
||||
} |
||||
|
||||
GDirEntry::~GDirEntry() { |
||||
delete name; |
||||
} |
||||
|
||||
GDir::GDir(char *name, GBool doStatA) { |
||||
path = new GString(name); |
||||
doStat = doStatA; |
||||
#if defined(WIN32) |
||||
GString *tmp; |
||||
|
||||
tmp = path->copy(); |
||||
tmp->append("/*.*"); |
||||
hnd = FindFirstFile(tmp->getCString(), &ffd); |
||||
delete tmp; |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
#else |
||||
dir = opendir(name); |
||||
#ifdef VMS |
||||
needParent = strchr(name, '[') != NULL; |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
GDir::~GDir() { |
||||
delete path; |
||||
#if defined(WIN32) |
||||
if (hnd) { |
||||
FindClose(hnd); |
||||
hnd = NULL; |
||||
} |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
#else |
||||
if (dir) |
||||
closedir(dir); |
||||
#endif |
||||
} |
||||
|
||||
GDirEntry *GDir::getNextEntry() { |
||||
GDirEntry *e; |
||||
|
||||
#if defined(WIN32) |
||||
if (hnd) { |
||||
e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); |
||||
if (hnd && !FindNextFile(hnd, &ffd)) { |
||||
FindClose(hnd); |
||||
hnd = NULL; |
||||
} |
||||
} else { |
||||
e = NULL; |
||||
} |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
#elif defined(VMS) |
||||
struct dirent *ent; |
||||
e = NULL; |
||||
if (dir) { |
||||
if (needParent) { |
||||
e = new GDirEntry(path->getCString(), "-", doStat); |
||||
needParent = gFalse; |
||||
return e; |
||||
} |
||||
ent = readdir(dir); |
||||
if (ent) { |
||||
e = new GDirEntry(path->getCString(), ent->d_name, doStat); |
||||
} |
||||
} |
||||
#else |
||||
struct dirent *ent; |
||||
e = NULL; |
||||
if (dir) { |
||||
ent = (struct dirent *)readdir(dir); |
||||
if (ent && !strcmp(ent->d_name, ".")) { |
||||
ent = (struct dirent *)readdir(dir); |
||||
} |
||||
if (ent) { |
||||
e = new GDirEntry(path->getCString(), ent->d_name, doStat); |
||||
} |
||||
} |
||||
#endif |
||||
|
||||
return e; |
||||
} |
||||
|
||||
void GDir::rewind() { |
||||
#ifdef WIN32 |
||||
GString *tmp; |
||||
|
||||
if (hnd) |
||||
FindClose(hnd); |
||||
tmp = path->copy(); |
||||
tmp->append("/*.*"); |
||||
hnd = FindFirstFile(tmp->getCString(), &ffd); |
||||
delete tmp; |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
#else |
||||
if (dir) |
||||
rewinddir(dir); |
||||
#ifdef VMS |
||||
needParent = strchr(path->getCString(), '[') != NULL; |
||||
#endif |
||||
#endif |
||||
} |
@ -1,151 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// gfile.h
|
||||
//
|
||||
// Miscellaneous file and directory name manipulation.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef GFILE_H |
||||
#define GFILE_H |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#if defined(WIN32) |
||||
# include <sys/stat.h> |
||||
# ifdef FPTEX |
||||
# include <win32lib.h> |
||||
# else |
||||
# include <windows.h> |
||||
# endif |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
# include <ctime.h> |
||||
#else |
||||
# include <unistd.h> |
||||
# include <sys/types.h> |
||||
# ifdef VMS |
||||
# include "vms_dirent.h" |
||||
# elif HAVE_DIRENT_H |
||||
# include <dirent.h> |
||||
# define NAMLEN(d) strlen((d)->d_name) |
||||
# else |
||||
# define dirent direct |
||||
# define NAMLEN(d) (d)->d_namlen |
||||
# if HAVE_SYS_NDIR_H |
||||
# include <sys/ndir.h> |
||||
# endif |
||||
# if HAVE_SYS_DIR_H |
||||
# include <sys/dir.h> |
||||
# endif |
||||
# if HAVE_NDIR_H |
||||
# include <ndir.h> |
||||
# endif |
||||
# endif |
||||
#endif |
||||
#include "gtypes.h" |
||||
|
||||
class GString; |
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// Get home directory path.
|
||||
extern GString *getHomeDir(); |
||||
|
||||
// Get current directory.
|
||||
extern GString *getCurrentDir(); |
||||
|
||||
// Append a file name to a path string. <path> may be an empty
|
||||
// string, denoting the current directory). Returns <path>.
|
||||
extern GString *appendToPath(GString *path, char *fileName); |
||||
|
||||
// Grab the path from the front of the file name. If there is no
|
||||
// directory component in <fileName>, returns an empty string.
|
||||
extern GString *grabPath(char *fileName); |
||||
|
||||
// Is this an absolute path or file name?
|
||||
extern GBool isAbsolutePath(char *path); |
||||
|
||||
// Make this path absolute by prepending current directory (if path is
|
||||
// relative) or prepending user's directory (if path starts with '~').
|
||||
extern GString *makePathAbsolute(GString *path); |
||||
|
||||
// Get the modification time for <fileName>. Returns 0 if there is an
|
||||
// error.
|
||||
extern time_t getModTime(char *fileName); |
||||
|
||||
// Create a temporary file and open it for writing. If <ext> is not
|
||||
// NULL, it will be used as the file name extension. Returns both the
|
||||
// name and the file pointer. For security reasons, all writing
|
||||
// should be done to the returned file pointer; the file may be
|
||||
// reopened later for reading, but not for writing. The <mode> string
|
||||
// should be "w" or "wb". Returns true on success.
|
||||
extern GBool openTempFile(GString **name, FILE **f, char *mode, char *ext); |
||||
|
||||
// Execute <command>. Returns true on success.
|
||||
extern GBool executeCommand(char *cmd); |
||||
|
||||
#ifdef WIN32 |
||||
// Convert a file name from Latin-1 to UTF-8.
|
||||
extern GString *fileNameToUTF8(char *path); |
||||
|
||||
// Convert a file name from UCS-2 to UTF-8.
|
||||
extern GString *fileNameToUTF8(wchar_t *path); |
||||
#endif |
||||
|
||||
// Open a file. On Windows, this converts the path from UTF-8 to
|
||||
// UCS-2 and calls _wfopen (if available). On other OSes, this simply
|
||||
// calls fopen.
|
||||
extern FILE *openFile(const char *path, const char *mode); |
||||
|
||||
// Just like fgets, but handles Unix, Mac, and/or DOS end-of-line
|
||||
// conventions.
|
||||
extern char *getLine(char *buf, int size, FILE *f); |
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GDir and GDirEntry
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class GDirEntry { |
||||
public: |
||||
|
||||
GDirEntry(char *dirPath, char *nameA, GBool doStat); |
||||
~GDirEntry(); |
||||
GString *getName() { return name; } |
||||
GBool isDir() { return dir; } |
||||
|
||||
private: |
||||
|
||||
GString *name; // dir/file name
|
||||
GBool dir; // is it a directory?
|
||||
}; |
||||
|
||||
class GDir { |
||||
public: |
||||
|
||||
GDir(char *name, GBool doStatA = gTrue); |
||||
~GDir(); |
||||
GDirEntry *getNextEntry(); |
||||
void rewind(); |
||||
|
||||
private: |
||||
|
||||
GString *path; // directory path
|
||||
GBool doStat; // call stat() for each entry?
|
||||
#if defined(WIN32) |
||||
WIN32_FIND_DATA ffd; |
||||
HANDLE hnd; |
||||
#elif defined(ACORN) |
||||
#elif defined(MACOS) |
||||
#else |
||||
DIR *dir; // the DIR structure from opendir()
|
||||
#ifdef VMS |
||||
GBool needParent; // need to return an entry for [-]
|
||||
#endif |
||||
#endif |
||||
}; |
||||
|
||||
#endif |
@ -1,296 +0,0 @@ |
||||
/*
|
||||
* gmem.c |
||||
* |
||||
* Memory routines with out-of-memory checking. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#include <aconf.h> |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <stddef.h> |
||||
#include <string.h> |
||||
#include <limits.h> |
||||
#include "gmem.h" |
||||
|
||||
#ifdef DEBUG_MEM |
||||
|
||||
typedef struct _GMemHdr { |
||||
unsigned int magic; |
||||
int size; |
||||
int index; |
||||
struct _GMemHdr *next, *prev; |
||||
} GMemHdr; |
||||
|
||||
#define gMemHdrSize ((sizeof(GMemHdr) + 7) & ~7) |
||||
#define gMemTrlSize (sizeof(long)) |
||||
|
||||
#define gMemMagic 0xabcd9999 |
||||
|
||||
#if gmemTrlSize==8 |
||||
#define gMemDeadVal 0xdeadbeefdeadbeefUL |
||||
#else |
||||
#define gMemDeadVal 0xdeadbeefUL |
||||
#endif |
||||
|
||||
/* round data size so trailer will be aligned */ |
||||
#define gMemDataSize(size) \ |
||||
((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize) |
||||
|
||||
static GMemHdr *gMemHead = NULL; |
||||
static GMemHdr *gMemTail = NULL; |
||||
|
||||
static int gMemIndex = 0; |
||||
static int gMemAlloc = 0; |
||||
static int gMemInUse = 0; |
||||
|
||||
#endif /* DEBUG_MEM */ |
||||
|
||||
void *gmalloc(int size) GMEM_EXCEP { |
||||
#ifdef DEBUG_MEM |
||||
int size1; |
||||
char *mem; |
||||
GMemHdr *hdr; |
||||
void *data; |
||||
unsigned long *trl, *p; |
||||
|
||||
if (size < 0) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Invalid memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
if (size == 0) { |
||||
return NULL; |
||||
} |
||||
size1 = gMemDataSize(size); |
||||
if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Out of memory\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
hdr = (GMemHdr *)mem; |
||||
data = (void *)(mem + gMemHdrSize); |
||||
trl = (unsigned long *)(mem + gMemHdrSize + size1); |
||||
hdr->magic = gMemMagic; |
||||
hdr->size = size; |
||||
hdr->index = gMemIndex++; |
||||
if (gMemTail) { |
||||
gMemTail->next = hdr; |
||||
hdr->prev = gMemTail; |
||||
gMemTail = hdr; |
||||
} else { |
||||
hdr->prev = NULL; |
||||
gMemHead = gMemTail = hdr; |
||||
} |
||||
hdr->next = NULL; |
||||
++gMemAlloc; |
||||
gMemInUse += size; |
||||
for (p = (unsigned long *)data; p <= trl; ++p) { |
||||
*p = gMemDeadVal; |
||||
} |
||||
return data; |
||||
#else |
||||
void *p; |
||||
|
||||
if (size < 0) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Invalid memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
if (size == 0) { |
||||
return NULL; |
||||
} |
||||
if (!(p = malloc(size))) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Out of memory\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
return p; |
||||
#endif |
||||
} |
||||
|
||||
void *grealloc(void *p, int size) GMEM_EXCEP { |
||||
#ifdef DEBUG_MEM |
||||
GMemHdr *hdr; |
||||
void *q; |
||||
int oldSize; |
||||
|
||||
if (size < 0) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Invalid memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
if (size == 0) { |
||||
if (p) { |
||||
gfree(p); |
||||
} |
||||
return NULL; |
||||
} |
||||
if (p) { |
||||
hdr = (GMemHdr *)((char *)p - gMemHdrSize); |
||||
oldSize = hdr->size; |
||||
q = gmalloc(size); |
||||
memcpy(q, p, size < oldSize ? size : oldSize); |
||||
gfree(p); |
||||
} else { |
||||
q = gmalloc(size); |
||||
} |
||||
return q; |
||||
#else |
||||
void *q; |
||||
|
||||
if (size < 0) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Invalid memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
if (size == 0) { |
||||
if (p) { |
||||
free(p); |
||||
} |
||||
return NULL; |
||||
} |
||||
if (p) { |
||||
q = realloc(p, size); |
||||
} else { |
||||
q = malloc(size); |
||||
} |
||||
if (!q) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Out of memory\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
return q; |
||||
#endif |
||||
} |
||||
|
||||
void *gmallocn(int nObjs, int objSize) GMEM_EXCEP { |
||||
int n; |
||||
|
||||
if (nObjs == 0) { |
||||
return NULL; |
||||
} |
||||
n = nObjs * objSize; |
||||
if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Bogus memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
return gmalloc(n); |
||||
} |
||||
|
||||
void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP { |
||||
int n; |
||||
|
||||
if (nObjs == 0) { |
||||
if (p) { |
||||
gfree(p); |
||||
} |
||||
return NULL; |
||||
} |
||||
n = nObjs * objSize; |
||||
if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { |
||||
#if USE_EXCEPTIONS |
||||
throw GMemException(); |
||||
#else |
||||
fprintf(stderr, "Bogus memory allocation size\n"); |
||||
exit(1); |
||||
#endif |
||||
} |
||||
return grealloc(p, n); |
||||
} |
||||
|
||||
void gfree(void *p) { |
||||
#ifdef DEBUG_MEM |
||||
int size; |
||||
GMemHdr *hdr; |
||||
unsigned long *trl, *clr; |
||||
|
||||
if (p) { |
||||
hdr = (GMemHdr *)((char *)p - gMemHdrSize); |
||||
if (hdr->magic == gMemMagic && |
||||
((hdr->prev == NULL) == (hdr == gMemHead)) && |
||||
((hdr->next == NULL) == (hdr == gMemTail))) { |
||||
if (hdr->prev) { |
||||
hdr->prev->next = hdr->next; |
||||
} else { |
||||
gMemHead = hdr->next; |
||||
} |
||||
if (hdr->next) { |
||||
hdr->next->prev = hdr->prev; |
||||
} else { |
||||
gMemTail = hdr->prev; |
||||
} |
||||
--gMemAlloc; |
||||
gMemInUse -= hdr->size; |
||||
size = gMemDataSize(hdr->size); |
||||
trl = (unsigned long *)((char *)hdr + gMemHdrSize + size); |
||||
if (*trl != gMemDeadVal) { |
||||
fprintf(stderr, "Overwrite past end of block %d at address %p\n", |
||||
hdr->index, p); |
||||
} |
||||
for (clr = (unsigned long *)hdr; clr <= trl; ++clr) { |
||||
*clr = gMemDeadVal; |
||||
} |
||||
free(hdr); |
||||
} else { |
||||
fprintf(stderr, "Attempted to free bad address %p\n", p); |
||||
} |
||||
} |
||||
#else |
||||
if (p) { |
||||
free(p); |
||||
} |
||||
#endif |
||||
} |
||||
|
||||
#ifdef DEBUG_MEM |
||||
void gMemReport(FILE *f) { |
||||
GMemHdr *p; |
||||
|
||||
fprintf(f, "%d memory allocations in all\n", gMemIndex); |
||||
if (gMemAlloc > 0) { |
||||
fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc); |
||||
fprintf(f, " index size\n"); |
||||
fprintf(f, "-------- --------\n"); |
||||
for (p = gMemHead; p; p = p->next) { |
||||
fprintf(f, "%8d %8d\n", p->index, p->size); |
||||
} |
||||
} else { |
||||
fprintf(f, "No memory blocks left allocated\n"); |
||||
} |
||||
} |
||||
#endif |
||||
|
||||
char *copyString(char *s) { |
||||
char *s1; |
||||
|
||||
s1 = (char *)gmalloc(strlen(s) + 1); |
||||
strcpy(s1, s); |
||||
return s1; |
||||
} |
@ -1,79 +0,0 @@ |
||||
/*
|
||||
* gmem.h |
||||
* |
||||
* Memory routines with out-of-memory checking. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef GMEM_H |
||||
#define GMEM_H |
||||
|
||||
#include <stdio.h> |
||||
#include <aconf.h> |
||||
|
||||
#if USE_EXCEPTIONS |
||||
|
||||
class GMemException { |
||||
public: |
||||
GMemException() {} |
||||
~GMemException() {} |
||||
}; |
||||
|
||||
#define GMEM_EXCEP throw(GMemException) |
||||
|
||||
#else // USE_EXCEPTIONS
|
||||
|
||||
#define GMEM_EXCEP |
||||
|
||||
#endif // USE_EXCEPTIONS
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/*
|
||||
* Same as malloc, but prints error message and exits if malloc() |
||||
* returns NULL. |
||||
*/ |
||||
extern void *gmalloc(int size) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* Same as realloc, but prints error message and exits if realloc() |
||||
* returns NULL. If <p> is NULL, calls malloc instead of realloc(). |
||||
*/ |
||||
extern void *grealloc(void *p, int size) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* These are similar to gmalloc and grealloc, but take an object count |
||||
* and size. The result is similar to allocating nObjs * objSize |
||||
* bytes, but there is an additional error check that the total size |
||||
* doesn't overflow an int. |
||||
*/ |
||||
extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP; |
||||
extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP; |
||||
|
||||
/*
|
||||
* Same as free, but checks for and ignores NULL pointers. |
||||
*/ |
||||
extern void gfree(void *p); |
||||
|
||||
#ifdef DEBUG_MEM |
||||
/*
|
||||
* Report on unfreed memory. |
||||
*/ |
||||
extern void gMemReport(FILE *f); |
||||
#else |
||||
#define gMemReport(f) |
||||
#endif |
||||
|
||||
/*
|
||||
* Allocate memory and copy a string into it. |
||||
*/ |
||||
extern char *copyString(char *s); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -1,32 +0,0 @@ |
||||
//========================================================================
|
||||
//
|
||||
// gmempp.cc
|
||||
//
|
||||
// Use gmalloc/gfree for C++ new/delete operators.
|
||||
//
|
||||
// Copyright 1996-2003 Glyph & Cog, LLC
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <aconf.h> |
||||
#include "gmem.h" |
||||
|
||||
#ifdef DEBUG_MEM |
||||
|
||||
void *operator new(size_t size) { |
||||
return gmalloc((int)size); |
||||
} |
||||
|
||||
void *operator new[](size_t size) { |
||||
return gmalloc((int)size); |
||||
} |
||||
|
||||
void operator delete(void *p) { |
||||
gfree(p); |
||||
} |
||||
|
||||
void operator delete[](void *p) { |
||||
gfree(p); |
||||
} |
||||
|
||||
#endif |
@ -1,29 +0,0 @@ |
||||
/*
|
||||
* gtypes.h |
||||
* |
||||
* Some useful simple types. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef GTYPES_H |
||||
#define GTYPES_H |
||||
|
||||
/*
|
||||
* These have stupid names to avoid conflicts with some (but not all) |
||||
* C++ compilers which define them. |
||||
*/ |
||||
typedef int GBool; |
||||
#define gTrue 1 |
||||
#define gFalse 0 |
||||
|
||||
/*
|
||||
* These have stupid names to avoid conflicts with <sys/types.h>, |
||||
* which on various systems defines some random subset of these. |
||||
*/ |
||||
typedef unsigned char Guchar; |
||||
typedef unsigned short Gushort; |
||||
typedef unsigned int Guint; |
||||
typedef unsigned long Gulong; |
||||
|
||||
#endif |
@ -1,190 +0,0 @@ |
||||
/*
|
||||
* parseargs.h |
||||
* |
||||
* Command line argument parser. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <stddef.h> |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <ctype.h> |
||||
#include "parseargs.h" |
||||
|
||||
static ArgDesc *findArg(ArgDesc *args, char *arg); |
||||
static GBool grabArg(ArgDesc *arg, int i, int *argc, char *argv[]); |
||||
|
||||
GBool parseArgs(ArgDesc *args, int *argc, char *argv[]) { |
||||
ArgDesc *arg; |
||||
int i, j; |
||||
GBool ok; |
||||
|
||||
ok = gTrue; |
||||
i = 1; |
||||
while (i < *argc) { |
||||
if (!strcmp(argv[i], "--")) { |
||||
--*argc; |
||||
for (j = i; j < *argc; ++j) |
||||
argv[j] = argv[j+1]; |
||||
break; |
||||
} else if ((arg = findArg(args, argv[i]))) { |
||||
if (!grabArg(arg, i, argc, argv)) |
||||
ok = gFalse; |
||||
} else { |
||||
++i; |
||||
} |
||||
} |
||||
return ok; |
||||
} |
||||
|
||||
void printUsage(char *program, char *otherArgs, ArgDesc *args) { |
||||
ArgDesc *arg; |
||||
char *typ; |
||||
int w, w1; |
||||
|
||||
w = 0; |
||||
for (arg = args; arg->arg; ++arg) { |
||||
if ((w1 = strlen(arg->arg)) > w) |
||||
w = w1; |
||||
} |
||||
|
||||
fprintf(stderr, "Usage: %s [options]", program); |
||||
if (otherArgs) |
||||
fprintf(stderr, " %s", otherArgs); |
||||
fprintf(stderr, "\n"); |
||||
|
||||
for (arg = args; arg->arg; ++arg) { |
||||
fprintf(stderr, " %s", arg->arg); |
||||
w1 = 9 + w - strlen(arg->arg); |
||||
switch (arg->kind) { |
||||
case argInt: |
||||
case argIntDummy: |
||||
typ = " <int>"; |
||||
break; |
||||
case argFP: |
||||
case argFPDummy: |
||||
typ = " <fp>"; |
||||
break; |
||||
case argString: |
||||
case argStringDummy: |
||||
typ = " <string>"; |
||||
break; |
||||
case argFlag: |
||||
case argFlagDummy: |
||||
default: |
||||
typ = ""; |
||||
break; |
||||
} |
||||
fprintf(stderr, "%-*s", w1, typ); |
||||
if (arg->usage) |
||||
fprintf(stderr, ": %s", arg->usage); |
||||
fprintf(stderr, "\n"); |
||||
} |
||||
} |
||||
|
||||
static ArgDesc *findArg(ArgDesc *args, char *arg) { |
||||
ArgDesc *p; |
||||
|
||||
for (p = args; p->arg; ++p) { |
||||
if (p->kind < argFlagDummy && !strcmp(p->arg, arg)) |
||||
return p; |
||||
} |
||||
return NULL; |
||||
} |
||||
|
||||
static GBool grabArg(ArgDesc *arg, int i, int *argc, char *argv[]) { |
||||
int n; |
||||
int j; |
||||
GBool ok; |
||||
|
||||
ok = gTrue; |
||||
n = 0; |
||||
switch (arg->kind) { |
||||
case argFlag: |
||||
*(GBool *)arg->val = gTrue; |
||||
n = 1; |
||||
break; |
||||
case argInt: |
||||
if (i + 1 < *argc && isInt(argv[i+1])) { |
||||
*(int *)arg->val = atoi(argv[i+1]); |
||||
n = 2; |
||||
} else { |
||||
ok = gFalse; |
||||
n = 1; |
||||
} |
||||
break; |
||||
case argFP: |
||||
if (i + 1 < *argc && isFP(argv[i+1])) { |
||||
*(double *)arg->val = atof(argv[i+1]); |
||||
n = 2; |
||||
} else { |
||||
ok = gFalse; |
||||
n = 1; |
||||
} |
||||
break; |
||||
case argString: |
||||
if (i + 1 < *argc) { |
||||
strncpy((char *)arg->val, argv[i+1], arg->size - 1); |
||||
((char *)arg->val)[arg->size - 1] = '\0'; |
||||
n = 2; |
||||
} else { |
||||
ok = gFalse; |
||||
n = 1; |
||||
} |
||||
break; |
||||
default: |
||||
fprintf(stderr, "Internal error in arg table\n"); |
||||
n = 1; |
||||
break; |
||||
} |
||||
if (n > 0) { |
||||
*argc -= n; |
||||
for (j = i; j < *argc; ++j) |
||||
argv[j] = argv[j+n]; |
||||
} |
||||
return ok; |
||||
} |
||||
|
||||
GBool isInt(char *s) { |
||||
if (*s == '-' || *s == '+') |
||||
++s; |
||||
while (isdigit(*s & 0xff)) |
||||
++s; |
||||
if (*s) |
||||
return gFalse; |
||||
return gTrue; |
||||
} |
||||
|
||||
GBool isFP(char *s) { |
||||
int n; |
||||
|
||||
if (*s == '-' || *s == '+') |
||||
++s; |
||||
n = 0; |
||||
while (isdigit(*s & 0xff)) { |
||||
++s; |
||||
++n; |
||||
} |
||||
if (*s == '.') |
||||
++s; |
||||
while (isdigit(*s & 0xff)) { |
||||
++s; |
||||
++n; |
||||
} |
||||
if (n > 0 && (*s == 'e' || *s == 'E')) { |
||||
++s; |
||||
if (*s == '-' || *s == '+') |
||||
++s; |
||||
n = 0; |
||||
if (!isdigit(*s & 0xff)) |
||||
return gFalse; |
||||
do { |
||||
++s; |
||||
} while (isdigit(*s & 0xff)); |
||||
} |
||||
if (*s) |
||||
return gFalse; |
||||
return gTrue; |
||||
} |
@ -1,71 +0,0 @@ |
||||
/*
|
||||
* parseargs.h |
||||
* |
||||
* Command line argument parser. |
||||
* |
||||
* Copyright 1996-2003 Glyph & Cog, LLC |
||||
*/ |
||||
|
||||
#ifndef PARSEARGS_H |
||||
#define PARSEARGS_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "gtypes.h" |
||||
|
||||
/*
|
||||
* Argument kinds. |
||||
*/ |
||||
typedef enum { |
||||
argFlag, /* flag (present / not-present) */ |
||||
/* [val: GBool *] */ |
||||
argInt, /* integer arg */ |
||||
/* [val: int *] */ |
||||
argFP, /* floating point arg */ |
||||
/* [val: double *] */ |
||||
argString, /* string arg */ |
||||
/* [val: char *] */ |
||||
/* dummy entries -- these show up in the usage listing only; */ |
||||
/* useful for X args, for example */ |
||||
argFlagDummy, |
||||
argIntDummy, |
||||
argFPDummy, |
||||
argStringDummy |
||||
} ArgKind; |
||||
|
||||
/*
|
||||
* Argument descriptor. |
||||
*/ |
||||
typedef struct { |
||||
char *arg; /* the command line switch */ |
||||
ArgKind kind; /* kind of arg */ |
||||
void *val; /* place to store value */ |
||||
int size; /* for argString: size of string */ |
||||
char *usage; /* usage string */ |
||||
} ArgDesc; |
||||
|
||||
/*
|
||||
* Parse command line. Removes all args which are found in the arg |
||||
* descriptor list <args>. Stops parsing if "--" is found (and removes |
||||
* it). Returns gFalse if there was an error. |
||||
*/ |
||||
extern GBool parseArgs(ArgDesc *args, int *argc, char *argv[]); |
||||
|
||||
/*
|
||||
* Print usage message, based on arg descriptor list. |
||||
*/ |
||||
extern void printUsage(char *program, char *otherArgs, ArgDesc *args); |
||||
|
||||
/*
|
||||
* Check if a string is a valid integer or floating point number. |
||||
*/ |
||||
extern GBool isInt(char *s); |
||||
extern GBool isFP(char *s); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -1,214 +0,0 @@ |
||||
/*
|
||||
* DIRECTORY.C - VMS emulation routines for UNIX Directory |
||||
* callable routines |
||||
* |
||||
* Author: Patrick L. Mahan |
||||
* Location: TGV, Inc |
||||
* Date: 19-November-1991 |
||||
* |
||||
* Purpose: Provides emulation of the BSD directory routines |
||||
* which are used by some of the X11 R4 release |
||||
* software. |
||||
* |
||||
* Side effects: This is only a partial emulation. Not all of |
||||
* the required information is passed to the user. |
||||
* |
||||
* Modification History |
||||
* |
||||
* Date | Who | Version | History |
||||
* ------------+-----------+---------------+---------------------------- |
||||
* 19-Nov-1991 | PLM | 1.0 | First Write |
||||
* 20-Apr-1992 | PLM | 1.1 | Added validation check for |
||||
* | | | for the directory |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include <rmsdef.h> |
||||
#include <descrip.h> |
||||
#include <lib$routines.h> |
||||
#include "vms_dirent.h" |
||||
|
||||
#define NOWILD 0x00000001 |
||||
#define MULTIPLE 0x00000002 |
||||
|
||||
static unsigned long context = 0; |
||||
|
||||
static struct dsc$descriptor_s *create_descriptor ( name ) |
||||
char *name; |
||||
{ |
||||
struct dsc$descriptor_s *retdescrip; |
||||
|
||||
retdescrip = (struct dsc$descriptor_s *)calloc(1, sizeof(struct dsc$descriptor_s)); |
||||
|
||||
if (retdescrip == NULL) return ((struct dsc$descriptor_s *)NULL); |
||||
|
||||
retdescrip->dsc$b_dtype = DSC$K_DTYPE_T; |
||||
retdescrip->dsc$b_class = DSC$K_CLASS_S; |
||||
retdescrip->dsc$w_length = strlen(name); |
||||
retdescrip->dsc$a_pointer = name; |
||||
|
||||
return (retdescrip); |
||||
} |
||||
|
||||
static int Check_Directory( dirname ) |
||||
char *dirname; |
||||
{ |
||||
static char *tmpdir, *cp; |
||||
FILE *tfp; |
||||
int status; |
||||
|
||||
status = 1; |
||||
|
||||
tmpdir = calloc(strlen(dirname)+15,sizeof(char)); |
||||
|
||||
strcpy(tmpdir, dirname); |
||||
|
||||
cp = strrchr(tmpdir, '.'); |
||||
|
||||
if (cp != NULL) { |
||||
*cp = ']'; |
||||
cp = strrchr(tmpdir, ']'); |
||||
*cp = '.'; |
||||
strcat(tmpdir, "dir"); |
||||
} |
||||
else { |
||||
char *tmp1; |
||||
tmp1 = calloc(strlen(dirname)+1,sizeof(char)); |
||||
cp = strchr(tmpdir, '['); |
||||
cp++; |
||||
strcpy(tmp1, cp); |
||||
cp = strrchr(tmp1, ']'); |
||||
*cp = '\0'; |
||||
cp = strchr(tmpdir, '['); |
||||
cp++; |
||||
*cp = '\0'; |
||||
strcat(tmpdir, "000000]"); |
||||
strcat(tmpdir, tmp1); |
||||
strcat(tmpdir, ".dir"); |
||||
} |
||||
|
||||
tfp = fopen(tmpdir, "r"); |
||||
|
||||
if (tfp == NULL) status = 0; |
||||
|
||||
fclose(tfp); |
||||
|
||||
return (status); |
||||
} |
||||
|
||||
DIR *opendir( dirname ) |
||||
char *dirname; |
||||
{ |
||||
DIR *retdir; |
||||
struct dsc$descriptor_s filedescriptor; |
||||
char *filepathname; |
||||
|
||||
retdir = (DIR *) calloc(1, sizeof(DIR)); |
||||
|
||||
if (retdir == NULL) return ((DIR *)NULL); |
||||
|
||||
if (!Check_Directory(dirname)) return ((DIR *)NULL); |
||||
|
||||
filepathname = (char *)calloc(256, sizeof(char)); |
||||
|
||||
strcpy(filepathname, dirname); |
||||
strcat(filepathname, "*.*.*"); |
||||
|
||||
retdir->dd_fd = (unsigned long) create_descriptor(filepathname); |
||||
retdir->dd_loc = 0; |
||||
retdir->dd_size = strlen(filepathname); |
||||
retdir->dd_bsize = 0; |
||||
retdir->dd_off = 0; |
||||
retdir->dd_buf = filepathname; |
||||
|
||||
return (retdir); |
||||
} |
||||
|
||||
struct dirent *readdir( dirp ) |
||||
DIR *dirp; |
||||
{ |
||||
static struct dirent *retdirent; |
||||
struct dsc$descriptor_s retfilenamedesc; |
||||
struct dsc$descriptor_s searchpathdesc = *((struct dsc$descriptor_s *)dirp->dd_fd); |
||||
char retfilename[256]; |
||||
char *sp; |
||||
unsigned long istatus; |
||||
unsigned long rms_status; |
||||
unsigned long flags; |
||||
|
||||
retdirent = (struct dirent *)NULL; |
||||
|
||||
flags = MULTIPLE; |
||||
|
||||
retfilenamedesc.dsc$b_dtype = DSC$K_DTYPE_T; |
||||
retfilenamedesc.dsc$b_class = DSC$K_CLASS_S; |
||||
retfilenamedesc.dsc$w_length = 255; |
||||
retfilenamedesc.dsc$a_pointer= retfilename; |
||||
|
||||
istatus = lib$find_file (&searchpathdesc, |
||||
&retfilenamedesc, |
||||
&dirp->dd_loc, |
||||
0, 0, |
||||
&rms_status, |
||||
&flags); |
||||
|
||||
if (!(istatus & 1) && (istatus != RMS$_NMF) && (istatus != RMS$_FNF)) |
||||
{ |
||||
lib$signal (istatus); |
||||
return (retdirent); |
||||
} |
||||
else if ((istatus == RMS$_NMF) || (istatus == RMS$_FNF)) |
||||
return (retdirent); |
||||
|
||||
retfilename[retfilenamedesc.dsc$w_length] = '\0'; |
||||
|
||||
sp = strchr(retfilename, ' '); |
||||
if (sp != NULL) *sp = '\0'; |
||||
|
||||
sp = strrchr(retfilename, ']'); |
||||
if (sp != NULL) |
||||
sp++; |
||||
else |
||||
sp = retfilename; |
||||
|
||||
retdirent = (struct dirent *)calloc(1, sizeof(struct dirent)); |
||||
|
||||
strcpy(retdirent->d_name, sp); |
||||
retdirent->d_namlen = strlen(sp); |
||||
retdirent->d_fileno = 0; |
||||
retdirent->d_off = 0; |
||||
retdirent->d_reclen = DIRSIZ(retdirent); |
||||
|
||||
return (retdirent); |
||||
} |
||||
|
||||
long telldir( dirp ) |
||||
DIR *dirp; |
||||
{ |
||||
return(0); |
||||
} |
||||
|
||||
void seekdir( dirp, loc ) |
||||
DIR *dirp; |
||||
int loc; |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
void rewinddir( dirp ) |
||||
DIR *dirp; |
||||
{ |
||||
lib$find_file_end (&dirp->dd_loc); |
||||
} |
||||
|
||||
void closedir( dirp ) |
||||
DIR *dirp; |
||||
{ |
||||
lib$find_file_end (&dirp->dd_loc); |
||||
|
||||
cfree ((void *) dirp->dd_fd); |
||||
cfree (dirp->dd_buf); |
||||
cfree (dirp); |
||||
} |
@ -1,67 +0,0 @@ |
||||
/* @(#)dirent.h 1.7 89/06/25 SMI */ |
||||
|
||||
/*
|
||||
* Filesystem-independent directory information. |
||||
*/ |
||||
|
||||
#ifndef __dirent_h |
||||
#define __dirent_h |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Make sure we don't get the V7 RTL dirent functions. These are broken. */ |
||||
|
||||
#ifndef __CRTL_VER |
||||
# define __CRTL_VER __VMS_VER |
||||
#endif |
||||
#if __CRTL_VER >= 70000000 |
||||
#include <dirent.h> |
||||
#endif |
||||
|
||||
#include <types.h> |
||||
|
||||
#define opendir goo_opendir |
||||
#define readdir goo_readdir |
||||
#define closedir goo_closedir |
||||
#define seekdir goo_seekdir |
||||
#define telldir goo_telldir |
||||
#define rewinddir goo_rewindir |
||||
#define DIR GOO_DIR |
||||
|
||||
#ifndef _POSIX_SOURCE |
||||
#define d_ino d_fileno /* compatability */ |
||||
#ifndef NULL |
||||
#define NULL 0 |
||||
#endif |
||||
#endif /* !_POSIX_SOURCE */ |
||||
|
||||
/*
|
||||
* Definitions for library routines operating on directories. |
||||
*/ |
||||
typedef struct __dirdesc { |
||||
unsigned long dd_fd; /* file descriptor */ |
||||
long dd_loc; /* buf offset of entry from last readddir() */ |
||||
long dd_size; /* amount of valid data in buffer */ |
||||
long dd_bsize; /* amount of entries read at a time */ |
||||
long dd_off; /* Current offset in dir (for telldir) */ |
||||
char *dd_buf; /* directory data buffer */ |
||||
} DIR; |
||||
|
||||
#include "vms_sys_dirent.h" |
||||
|
||||
extern DIR *opendir(char *dirname); |
||||
extern struct dirent *readdir(DIR *dirp); |
||||
extern void closedir(DIR *dirp); |
||||
#ifndef _POSIX_SOURCE |
||||
extern void seekdir(DIR *dirp, int loc); |
||||
extern long telldir(DIR *dirp); |
||||
#endif /* POSIX_SOURCE */ |
||||
extern void rewinddir(DIR *dirp); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* !__dirent_h */ |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue