From 7fcd065e8b183d36e1ac9ce069d6d2b0e92e3178 Mon Sep 17 00:00:00 2001 From: Brian Ewins Date: Mon, 13 Apr 2009 01:31:23 +0100 Subject: [PATCH 2/2] Fix bug 3188, do not re-sort selected text With the application of the previous patch to iterate over the selection in reading order, we no longer need to sort the selected text vertically. This patch simply bypasses the sorts, and gives the desired result - pasted text is in reading order. However, the output is not as clean as TextPage::dump yet, and the two mechanisms should share code. --- poppler/TextOutputDev.cc | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index cd99de3..83afd1d 100755 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -3379,17 +3379,10 @@ GooString *TextPage::getText(double xMin, double yMin, for (i = 0; i < nFrags; ++i) { frags[i].computeCoords(oneRot); } - assignColumns(frags, nFrags, oneRot); + // ignore rotation, since text is already + // in reading order. + assignColumns(frags, nFrags, 0); - // if all lines in the region have the same rotation, use it; - // otherwise, use the page's primary rotation - if (oneRot) { - qsort(frags, nFrags, sizeof(TextLineFrag), - &TextLineFrag::cmpYXLineRot); - } else { - qsort(frags, nFrags, sizeof(TextLineFrag), - &TextLineFrag::cmpYXPrimaryRot); - } i = 0; while (i < nFrags) { delta = maxIntraLineDelta * frags[i].line->words->fontSize; -- 1.6.2.2