Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/TextOutputDev.h
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 22:20:42 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 22:20:42 (GMT)
commit2a393c134fe3fe8eb85bf818cb7ad6ae4396322a (patch)
treeeba8b0dcaba42d799ed8313faee15fb74a5a0cd2 /pdf/xpdf/TextOutputDev.h
parent7aac8dc8533347e21311b15186e0af82f1b22fd6 (diff)
Synched with Xpdf 1.01
Diffstat (limited to 'pdf/xpdf/TextOutputDev.h')
-rw-r--r--pdf/xpdf/TextOutputDev.h79
1 files changed, 39 insertions, 40 deletions
diff --git a/pdf/xpdf/TextOutputDev.h b/pdf/xpdf/TextOutputDev.h
index a041e23..daab3c4 100644
--- a/pdf/xpdf/TextOutputDev.h
+++ b/pdf/xpdf/TextOutputDev.h
@@ -2,7 +2,7 @@
//
// TextOutputDev.h
//
-// Copyright 1997 Derek B. Noonburg
+// Copyright 1997-2002 Glyph & Cog, LLC
//
//========================================================================
@@ -23,12 +23,7 @@ class GString;
//------------------------------------------------------------------------
-enum TextOutputCharSet {
- textOutASCII7,
- textOutLatin1,
- textOutLatin2,
- textOutLatin5
-};
+typedef void (*TextOutputFunc)(void *stream, char *text, int len);
//------------------------------------------------------------------------
// TextString
@@ -38,31 +33,26 @@ class TextString {
public:
// Constructor.
- TextString(GfxState *state, GBool hexCodes1);
+ TextString(GfxState *state, double fontSize);
// Destructor.
~TextString();
// Add a character to the string.
void addChar(GfxState *state, double x, double y,
- double dx, double dy,
- Guchar c, TextOutputCharSet charSet);
-
- // Add a 16-bit character to the string.
- void addChar16(GfxState *state, double x, double y,
- double dx, double dy,
- int c, GfxFontCharSet16 charSet);
+ double dx, double dy, Unicode u);
private:
double xMin, xMax; // bounding box x coordinates
double yMin, yMax; // bounding box y coordinates
int col; // starting column
- GString *text; // the text
+ Unicode *text; // the text
double *xRight; // right-hand x coord of each char
+ int len; // length of text and xRight
+ int size; // size of text and xRight arrays
TextString *yxNext; // next string in y-major order
TextString *xyNext; // next string in x-major order
- GBool hexCodes; // subsetted font with hex char codes
friend class TextPage;
};
@@ -75,22 +65,20 @@ class TextPage {
public:
// Constructor.
- TextPage(TextOutputCharSet charSet, GBool rawOrder);
+ TextPage(GBool rawOrderA);
// Destructor.
~TextPage();
+ // Update the current font.
+ void updateFont(GfxState *state);
+
// Begin a new string.
- void beginString(GfxState *state, GString *s, GBool hex1);
+ void beginString(GfxState *state);
// Add a character to the current string.
void addChar(GfxState *state, double x, double y,
- double dx, double dy, Guchar c);
-
- // Add a 16-bit character to the current string.
- void addChar16(GfxState *state, double x, double y,
- double dx, double dy, int c,
- GfxFontCharSet16 charSet);
+ double dx, double dy, Unicode *u, int uLen);
// End the current string, sorting it into the list of strings.
void endString();
@@ -103,7 +91,8 @@ public:
// stops looking at bottom of page; otherwise stops looking at
// <xMax>,<yMax>. If found, sets the text bounding rectange and
// returns true; otherwise returns false.
- GBool findText(char *s, GBool top, GBool bottom,
+ GBool findText(Unicode *s, int len,
+ GBool top, GBool bottom,
double *xMin, double *yMin,
double *xMax, double *yMax);
@@ -112,17 +101,17 @@ public:
double xMax, double yMax);
// Dump contents of page to a file.
- void dump(FILE *f);
+ void dump(void *outputStream, TextOutputFunc outputFunc);
// Clear the page.
void clear();
private:
- TextOutputCharSet charSet; // character set
GBool rawOrder; // keep strings in content stream order
TextString *curStr; // currently active string
+ double fontSize; // current font size
TextString *yxStrings; // strings in y-major order
TextString *xyStrings; // strings in x-major order
@@ -139,12 +128,13 @@ class TextOutputDev: public OutputDev {
public:
// Open a text output file. If <fileName> is NULL, no file is
- // written (this is useful, e.g., for searching text). Text is
- // converted to the character set specified by <charSet>. This
- // should be set to textOutASCII7 for Japanese (EUC-JP) text. If
+ // written (this is useful, e.g., for searching text). If
// <rawOrder> is true, the text is kept in content stream order.
- TextOutputDev(char *fileName, TextOutputCharSet charSet,
- GBool rawOrder);
+ 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();
@@ -161,6 +151,13 @@ public:
// 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,9 +173,9 @@ public:
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, Guchar c);
- virtual void drawChar16(GfxState *state, double x, double y,
- double dx, double dy, int c);
+ double dx, double dy,
+ double originX, double originY,
+ CharCode c, Unicode *u, int uLen);
//----- special access
@@ -187,17 +184,19 @@ public:
// stops looking at bottom of page; otherwise stops looking at
// <xMax>,<yMax>. If found, sets the text bounding rectange and
// returns true; otherwise returns false.
- GBool findText(char *s, GBool top, GBool bottom,
+ GBool findText(Unicode *s, int len,
+ GBool top, GBool bottom,
double *xMin, double *yMin,
double *xMax, double *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 hexCodes; // subsetted font with hex char codes
GBool ok; // set up ok?
};