summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-02-01 06:11:18 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-02-01 06:11:18 +0000
commit4f9de1dfebdc66d367d730252d6f224d37e96ee6 (patch)
tree3750421fabf3aa8a8e1f4f6d5558d489e9d4fe02 /Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
parent9d694205709f79666458dc2ee685767b28bcd9ac (diff)
xpdf 4.03
git-svn-id: svn://tug.org/texlive/trunk@57588 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h68
1 files changed, 56 insertions, 12 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
index 0f00cf5ae7b..a1d19c22d7d 100644
--- a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
+++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
@@ -42,12 +42,19 @@ enum TextOutputMode {
textOutReadingOrder, // format into reading order
textOutPhysLayout, // maintain original physical layout
textOutSimpleLayout, // simple one-column physical layout
+ textOutSimple2Layout, // simple one-column physical layout
textOutTableLayout, // similar to PhysLayout, but optimized
// for tables
textOutLinePrinter, // strict fixed-pitch/height layout
textOutRawOrder // keep text in content stream order
};
+enum TextOutputOverlapHandling {
+ textOutIgnoreOverlaps, // no special handling for overlaps
+ textOutAppendOverlaps, // append overlapping text to main text
+ textOutDiscardOverlaps // discard overlapping text
+};
+
class TextOutputControl {
public:
@@ -66,8 +73,17 @@ public:
// in after forming columns
GBool discardDiagonalText; // discard all text that's not close to
// 0/90/180/270 degrees
+ GBool discardRotatedText; // discard all text that's not horizontal
+ // (0 degrees)
GBool discardInvisibleText; // discard all invisible characters
GBool discardClippedText; // discard all clipped characters
+ GBool splitRotatedWords; // do not combine horizontal and
+ // non-horizontal chars in a single
+ // word
+ TextOutputOverlapHandling // how to handle overlapping text
+ overlapHandling;
+ GBool separateLargeChars; // separate "large" characters from
+ // "regular" characters
GBool insertBOM; // insert a Unicode BOM at the start of
// the text output
double marginLeft, // characters outside the margins are
@@ -124,7 +140,7 @@ class TextWord {
public:
TextWord(GList *chars, int start, int lenA,
- int rotA, int dirA, GBool spaceAfterA);
+ int rotA, GBool rotatedA, int dirA, GBool spaceAfterA);
~TextWord();
TextWord *copy() { return new TextWord(this); }
@@ -144,6 +160,7 @@ public:
double *xMaxA, double *yMaxA);
double getFontSize() { return fontSize; }
int getRotation() { return rot; }
+ GBool isRotated() { return (GBool)rotated; }
int getCharPos() { return charPos[0]; }
int getCharLen() { return charPos[len] - charPos[0]; }
int getDirection() { return dir; }
@@ -158,8 +175,6 @@ private:
static int cmpYX(const void *p1, const void *p2);
static int cmpCharPos(const void *p1, const void *p2);
- int rot; // rotation, multiple of 90 degrees
- // (0, 1, 2, or 3)
double xMin, xMax; // bounding box x coordinates
double yMin, yMax; // bounding box y coordinates
Unicode *text; // the text
@@ -171,19 +186,22 @@ private:
int len; // number of characters
TextFontInfo *font; // font information
double fontSize; // font size
- int dir; // character direction (+1 = left-to-right;
- // -1 = right-to-left; 0 = neither)
- GBool spaceAfter; // set if there is a space between this
- // word and the next word on the line
-
- GBool underlined;
TextLink *link;
-
double colorR, // word color
colorG,
colorB;
GBool invisible; // set for invisible text (render mode 3)
+ // group the byte-size fields to minimize object size
+ Guchar rot; // rotation, multiple of 90 degrees
+ // (0, 1, 2, or 3)
+ char rotated; // set if this word is non-horizontal
+ char dir; // character direction (+1 = left-to-right;
+ // -1 = right-to-left; 0 = neither)
+ char spaceAfter; // set if there is a space between this
+ // word and the next word on the line
+ char underlined;
+
friend class TextBlock;
friend class TextLine;
friend class TextPage;
@@ -209,6 +227,7 @@ public:
GList *getWords() { return words; }
int getLength() { return len; }
double getEdge(int idx) { return edge[idx]; }
+ GBool getHyphenated() { return hyphenated; }
private:
@@ -407,6 +426,16 @@ public:
// are no columns.
GBool findPointNear(double x, double y, TextPosition *pos);
+ // Find the start and end of a word inside a column. Returns false
+ // if x,y fall outside all columns.
+ GBool findWordPoints(double x, double y,
+ TextPosition *startPos, TextPosition *endPos);
+
+ // Find the start and end of a line inside a column. Returns false
+ // if x,y fall outside all columns.
+ GBool findLinePoints(double x, double y,
+ TextPosition *startPos, TextPosition *endPos);
+
// Get the upper point of a TextPosition.
void convertPosToPointUpper(TextPosition *pos, double *x, double *y);
@@ -478,6 +507,11 @@ private:
UnicodeMap *uMap,
char *space, int spaceLen,
char *eol, int eolLen);
+ void writeSimple2Layout(void *outputStream,
+ TextOutputFunc outputFunc,
+ UnicodeMap *uMap,
+ char *space, int spaceLen,
+ char *eol, int eolLen);
void writeLinePrinter(void *outputStream,
TextOutputFunc outputFunc,
UnicodeMap *uMap,
@@ -493,12 +527,17 @@ private:
// analysis
int rotateChars(GList *charsA);
+ void rotateCharsToZero(GList *charsA);
void rotateUnderlinesAndLinks(int rot);
void unrotateChars(GList *charsA, int rot);
+ void unrotateCharsFromZero(GList *charsA);
+ void unrotateColumnsFromZero(GList *columns);
void unrotateColumns(GList *columns, int rot);
void unrotateWords(GList *words, int rot);
GBool checkPrimaryLR(GList *charsA);
void removeDuplicates(GList *charsA, int rot);
+ GList *separateOverlappingText(GList *charsA);
+ TextColumn *buildOverlappingTextColumn(GList *overlappingChars);
TextBlock *splitChars(GList *charsA);
TextBlock *split(GList *charsA, int rot);
GList *getChars(GList *charsA, double xMin, double yMin,
@@ -522,8 +561,12 @@ private:
double getLineIndent(TextLine *line, TextBlock *blk);
double getAverageLineSpacing(GList *lines);
double getLineSpacing(TextLine *line0, TextLine *line1);
- void buildLines(TextBlock *blk, GList *lines);
+ void buildLines(TextBlock *blk, GList *lines, GBool splitSuperLines);
+ GList *buildSimple2Columns(GList *charsA);
+ GList *buildSimple2Lines(GList *charsA, int rot);
TextLine *buildLine(TextBlock *blk);
+ TextLine *buildLine(GList *charsA, int rot,
+ double xMin, double yMin, double xMax, double yMax);
void getLineChars(TextBlock *blk, GList *charsA);
double computeWordSpacingThreshold(GList *charsA, int rot);
int getCharDirection(TextChar *ch);
@@ -563,6 +606,7 @@ private:
int curRot; // current rotation
GBool diagonal; // set if rotation is not close to
// 0/90/180/270 degrees
+ GBool rotated; // set if text is not horizontal (0 degrees)
int nTinyChars; // number of "tiny" chars seen so far
Unicode *actualText; // current "ActualText" span
int actualTextLen;
@@ -605,7 +649,7 @@ public:
// is maintained. If <rawOrder> is true, the text is kept in
// content stream order.
TextOutputDev(char *fileName, TextOutputControl *controlA,
- GBool append);
+ GBool append, GBool fileNameIsUTF8 = gFalse);
// Create a TextOutputDev which will write to a generic stream. If
// <physLayoutA> is true, the original physical layout of the text