From 089fb42e0fac2ae09c22e42d2f9bd542704a5b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Aliste?= Date: Wed, 16 Feb 2011 07:02:01 -0300 Subject: [PATCH] Break words when Font changes. --- poppler/TextOutputDev.cc | 4 +++- poppler/TextOutputDev.h | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index 71b946e..0dc503d 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -2208,6 +2208,7 @@ void TextPage::addChar(GfxState *state, double x, double y, // (3) the previous character was an overlap (we want each duplicated // character to be in a word by itself at this stage), // (4) the font size has changed + // (5) the gfxFont has changed if (curWord && curWord->len > 0) { base = sp = delta = 0; // make gcc happy switch (curWord->rot) { @@ -2238,7 +2239,8 @@ void TextPage::addChar(GfxState *state, double x, double y, sp < -minDupBreakOverlap * curWord->fontSize || sp > minWordBreakSpace * curWord->fontSize || fabs(base - curWord->base) > 0.5 || - curFontSize != curWord->fontSize) { + curFontSize != curWord->fontSize || + curFont->isEqual(curWord->font)) { endWord(); } lastCharOverlap = overlap; diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h index 438aee4..37f40a9 100644 --- a/poppler/TextOutputDev.h +++ b/poppler/TextOutputDev.h @@ -86,6 +86,7 @@ public: GBool isSymbolic() { return flags & fontSymbolic; } GBool isItalic() { return flags & fontItalic; } GBool isBold() { return flags & fontBold; } + isEqualTo(TextFontInfo *other) { return (gfxFont == other->gfxFont); } #endif private: @@ -574,10 +575,10 @@ public: #endif private: - + // Destructor. ~TextPage(); - + void clear(); void assignColumns(TextLineFrag *frags, int nFrags, GBool rot); int dumpFragment(Unicode *text, int len, UnicodeMap *uMap, GooString *s); @@ -652,7 +653,7 @@ private: double actualText_x, actualText_y; // extent of the text inside the span double actualText_dx, actualText_dy; }; - + //------------------------------------------------------------------------ // TextOutputDev -- 1.7.3.5