diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index 442ace2..ea10181 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -2076,7 +2076,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 && curWord->font && curFont->gfxFont != curWord->font->gfxFont)) { endWord(); } lastCharOverlap = overlap; @@ -3810,12 +3811,12 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor, end = NULL; current = NULL; for (p = words; p != NULL; p = p->next) { - if ((selection->x1 < p->xMax && selection->y1 < p->yMax) || - (selection->x2 < p->xMax && selection->y2 < p->yMax)) + if ((selection->x1 < p->xMax) || + (selection->x2 < p->xMax)) if (begin == NULL) begin = p; - if (((selection->x1 > p->xMin && selection->y1 > p->yMin) || - (selection->x2 > p->xMin && selection->y2 > p->yMin)) && (begin != NULL)) { + if (((selection->x1 > p->xMin) || + (selection->x2 > p->xMin)) && (begin != NULL)) { end = p->next; current = p; }