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 @@ | |||
1 | //======================================================================== | 1 | //======================================================================== |
2 | // | 2 | // |
3 | // TextOutputDev.h | 3 | // TextOutputDev.h |
4 | // | 4 | // |
5 | // Copyright 1997 Derek B. Noonburg | 5 | // Copyright 1997-2002 Glyph & Cog, LLC |
6 | // | 6 | // |
7 | //======================================================================== | 7 | //======================================================================== |
8 | 8 | ||
9 | #ifndef TEXTOUTPUTDEV_H | 9 | #ifndef TEXTOUTPUTDEV_H |
10 | #define TEXTOUTPUTDEV_H | 10 | #define TEXTOUTPUTDEV_H |
11 | 11 | ||
@@ -19,12 +19,16 @@ | |||
19 | #include "OutputDev.h" | 19 | #include "OutputDev.h" |
20 | 20 | ||
21 | class GfxState; | 21 | class GfxState; |
22 | class GString; | 22 | class GString; |
23 | 23 | ||
24 | //------------------------------------------------------------------------ | 24 | //------------------------------------------------------------------------ |
25 | |||
26 | typedef void (*TextOutputFunc)(void *stream, char *text, int len); | ||
27 | |||
28 | //------------------------------------------------------------------------ | ||
25 | // TextString | 29 | // TextString |
26 | //------------------------------------------------------------------------ | 30 | //------------------------------------------------------------------------ |
27 | 31 | ||
28 | class TextString { | 32 | class TextString { |
29 | public: | 33 | public: |
30 | 34 | ||
@@ -94,13 +98,13 @@ public: | |||
94 | 98 | ||
95 | // Get the text which is inside the specified rectangle. | 99 | // Get the text which is inside the specified rectangle. |
96 | GString *getText(fouble xMin, fouble yMin, | 100 | GString *getText(fouble xMin, fouble yMin, |
97 | fouble xMax, fouble yMax); | 101 | fouble xMax, fouble yMax); |
98 | 102 | ||
99 | // Dump contents of page to a file. | 103 | // Dump contents of page to a file. |
100 | void dump(FILE *f); | 104 | void dump(void *outputStream, TextOutputFunc outputFunc); |
101 | 105 | ||
102 | // Clear the page. | 106 | // Clear the page. |
103 | void clear(); | 107 | void clear(); |
104 | 108 | ||
105 | private: | 109 | private: |
106 | 110 | ||
@@ -125,12 +129,16 @@ public: | |||
125 | 129 | ||
126 | // Open a text output file. If <fileName> is NULL, no file is | 130 | // Open a text output file. If <fileName> is NULL, no file is |
127 | // written (this is useful, e.g., for searching text). If | 131 | // written (this is useful, e.g., for searching text). If |
128 | // <rawOrder> is true, the text is kept in content stream order. | 132 | // <rawOrder> is true, the text is kept in content stream order. |
129 | TextOutputDev(char *fileName, GBool rawOrderA, GBool append); | 133 | TextOutputDev(char *fileName, GBool rawOrderA, GBool append); |
130 | 134 | ||
135 | // Create a TextOutputDev which will write to a generic stream. If | ||
136 | // <rawOrder> is true, the text is kept in content stream order. | ||
137 | TextOutputDev(TextOutputFunc func, void *stream, GBool rawOrderA); | ||
138 | |||
131 | // Destructor. | 139 | // Destructor. |
132 | virtual ~TextOutputDev(); | 140 | virtual ~TextOutputDev(); |
133 | 141 | ||
134 | // Check if file was successfully created. | 142 | // Check if file was successfully created. |
135 | virtual GBool isOk() { return ok; } | 143 | virtual GBool isOk() { return ok; } |
136 | 144 | ||
@@ -140,12 +148,16 @@ public: | |||
140 | // (Upside-down means (0,0) is the top left corner of the page.) | 148 | // (Upside-down means (0,0) is the top left corner of the page.) |
141 | virtual GBool upsideDown() { return gTrue; } | 149 | virtual GBool upsideDown() { return gTrue; } |
142 | 150 | ||
143 | // Does this device use drawChar() or drawString()? | 151 | // Does this device use drawChar() or drawString()? |
144 | virtual GBool useDrawChar() { return gTrue; } | 152 | virtual GBool useDrawChar() { return gTrue; } |
145 | 153 | ||
154 | // Does this device use beginType3Char/endType3Char? Otherwise, | ||
155 | // text in Type 3 fonts will be drawn with drawChar/drawString. | ||
156 | virtual GBool interpretType3Chars() { return gFalse; } | ||
157 | |||
146 | // Does this device need non-text content? | 158 | // Does this device need non-text content? |
147 | virtual GBool needNonText() { return gFalse; } | 159 | virtual GBool needNonText() { return gFalse; } |
148 | 160 | ||
149 | //----- initialization and control | 161 | //----- initialization and control |
150 | 162 | ||
151 | // Start a page. | 163 | // Start a page. |
@@ -176,14 +188,16 @@ public: | |||
176 | GBool top, GBool bottom, | 188 | GBool top, GBool bottom, |
177 | fouble *xMin, fouble *yMin, | 189 | fouble *xMin, fouble *yMin, |
178 | fouble *xMax, fouble *yMax); | 190 | fouble *xMax, fouble *yMax); |
179 | 191 | ||
180 | private: | 192 | private: |
181 | 193 | ||
182 | FILE *f; // text file | 194 | TextOutputFunc outputFunc;// output function |
183 | GBool needClose; // need to close the file? | 195 | void *outputStream; // output stream |
196 | GBool needClose; // need to close the output file? | ||
197 | // (only if outputStream is a FILE*) | ||
184 | TextPage *text; // text for the current page | 198 | TextPage *text; // text for the current page |
185 | GBool rawOrder; // keep text in content stream order | 199 | GBool rawOrder; // keep text in content stream order |
186 | GBool ok; // set up ok? | 200 | GBool ok; // set up ok? |
187 | }; | 201 | }; |
188 | 202 | ||
189 | #endif | 203 | #endif |