From 33de66c3b59f078a2861c2491cf8f31f6f751c2a Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 25 Mar 2012 21:44:39 +1030 Subject: [PATCH 7/7] Don't start a new word due to character overlap if the previous char is a control char --- poppler/TextOutputDev.cc | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index e97fe55..c1975e0 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -2367,11 +2367,14 @@ void TextPage::addChar(GfxState *state, double x, double y, // the end of the previous word (this places upper and lower // constraints on the position deltas along both the primary // and secondary axes), or - // (2) this character overlaps the previous one (duplicated text), or + // (2) this character overlaps the previous one (duplicated text) except when + // the previous character is a control character (<= 31), or // (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 - if (curWord && curWord->len > 0) { + if (curWord && curWord->len > 0 && + curWord->textOffset[curWord->len] - curWord->textOffset[curWord->len - 1] == 1 && + curWord->text[curWord->textOffset[curWord->len - 1]] > 31) { base = sp = delta = 0; // make gcc happy switch (curWord->rot) { case 0: -- 1.7.5.4