Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/TextOutputDev.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/TextOutputDev.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/TextOutputDev.h b/noncore/unsupported/qpdf/xpdf/TextOutputDev.h index 4c71e5e..f0f238e 100644 --- a/noncore/unsupported/qpdf/xpdf/TextOutputDev.h +++ b/noncore/unsupported/qpdf/xpdf/TextOutputDev.h @@ -1,11 +1,11 @@ //======================================================================== // // TextOutputDev.h // -// Copyright 1997 Derek B. Noonburg +// Copyright 1997-2002 Glyph & Cog, LLC // //======================================================================== #ifndef TEXTOUTPUTDEV_H #define TEXTOUTPUTDEV_H @@ -19,12 +19,16 @@ #include "OutputDev.h" class GfxState; class GString; //------------------------------------------------------------------------ + +typedef void (*TextOutputFunc)(void *stream, char *text, int len); + +//------------------------------------------------------------------------ // TextString //------------------------------------------------------------------------ class TextString { public: @@ -94,13 +98,13 @@ public: // Get the text which is inside the specified rectangle. GString *getText(fouble xMin, fouble yMin, fouble xMax, fouble yMax); // Dump contents of page to a file. - void dump(FILE *f); + void dump(void *outputStream, TextOutputFunc outputFunc); // Clear the page. void clear(); private: @@ -125,12 +129,16 @@ public: // Open a text output file. If <fileName> is NULL, no file is // written (this is useful, e.g., for searching text). If // <rawOrder> is true, the text is kept in content stream order. TextOutputDev(char *fileName, GBool rawOrderA, GBool append); + // Create a TextOutputDev which will write to a generic stream. If + // <rawOrder> is true, the text is kept in content stream order. + TextOutputDev(TextOutputFunc func, void *stream, GBool rawOrderA); + // Destructor. virtual ~TextOutputDev(); // Check if file was successfully created. virtual GBool isOk() { return ok; } @@ -140,12 +148,16 @@ public: // (Upside-down means (0,0) is the top left corner of the page.) virtual GBool upsideDown() { return gTrue; } // Does this device use drawChar() or drawString()? virtual GBool useDrawChar() { return gTrue; } + // Does this device use beginType3Char/endType3Char? Otherwise, + // text in Type 3 fonts will be drawn with drawChar/drawString. + virtual GBool interpretType3Chars() { return gFalse; } + // Does this device need non-text content? virtual GBool needNonText() { return gFalse; } //----- initialization and control // Start a page. @@ -176,14 +188,16 @@ public: GBool top, GBool bottom, fouble *xMin, fouble *yMin, fouble *xMax, fouble *yMax); private: - FILE *f; // text file - GBool needClose; // need to close the file? + TextOutputFunc outputFunc; // output function + void *outputStream; // output stream + GBool needClose; // need to close the output file? + // (only if outputStream is a FILE*) TextPage *text; // text for the current page GBool rawOrder; // keep text in content stream order GBool ok; // set up ok? }; #endif |