diff --git a/poppler/CharTypes.h b/poppler/CharTypes.h index d0df630..89eceba 100644 --- a/poppler/CharTypes.h +++ b/poppler/CharTypes.h @@ -20,5 +20,6 @@ typedef unsigned int CID; // - 16-bit CID // - Unicode typedef unsigned int CharCode; +#define CHARCODE_LIGATED 0xFFFFFFFF #endif diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index eeea6f7..4493869 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -2392,6 +2392,7 @@ void TextPage::addChar(GfxState *state, double x, double y, w1 /= uLen; h1 /= uLen; for (i = 0; i < uLen; ++i) { + if (i > 0) c = CHARCODE_LIGATED; curWord->addChar(state, curFont, x1 + i*w1, y1 + i*h1, w1, h1, charPos, nBytes, c, u[i], mat); } } @@ -4377,6 +4378,9 @@ void TextSelectionPainter::endPage() TextWordSelection *sel = (TextWordSelection *) selectionList->get(i); int begin = sel->begin; + while (begin < sel->end && begin > 0 && sel->word->charcode[begin] == CHARCODE_LIGATED) + begin--; + while (begin < sel->end) { TextFontInfo *font = sel->word->font[begin]; font->gfxFont->incRefCnt(); @@ -4400,8 +4404,9 @@ void TextSelectionPainter::endPage() out->beginString(state, string); for (int i = begin; i < fEnd; i++) { - out->drawChar(state, sel->word->textMat[i].m[4], sel->word->textMat[i].m[5], 0, 0, 0, 0, - sel->word->charcode[i], 1, NULL, 0); + if (sel->word->charcode[i] != CHARCODE_LIGATED) + out->drawChar(state, sel->word->textMat[i].m[4], sel->word->textMat[i].m[5], 0, 0, 0, 0, + sel->word->charcode[i], 1, NULL, 0); } out->endString(state); delete string;