diff --git a/.gitignore b/.gitignore index 302df64..d224049 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /poppler-21.01.0.tar.xz /poppler-21.07.0.tar.xz /poppler-21.08.0.tar.xz +/poppler-22.01.0.tar.xz diff --git a/poppler-0.30.0-rotated-words-selection.patch b/poppler-0.30.0-rotated-words-selection.patch deleted file mode 100644 index 98230f9..0000000 --- a/poppler-0.30.0-rotated-words-selection.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 0ab1f29d4ce315b0fca260c0e0f3007024d00342 Mon Sep 17 00:00:00 2001 -From: Marek Kasik -Date: Tue, 28 Jan 2014 15:13:24 +0100 -Subject: [PATCH] TextOutputDev: Respect orientation when selecting words - -Take rotation into account when visiting selection. -This doesn't fix all problems (there are still problems -on line and block levels). - -https://bugs.freedesktop.org/show_bug.cgi?id=16619 ---- - poppler/TextOutputDev.cc | 193 ++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 150 insertions(+), 43 deletions(-) - -diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc -index 7c2ca78..e93908c 100644 ---- a/poppler/TextOutputDev.cc -+++ b/poppler/TextOutputDev.cc -@@ -178,6 +178,12 @@ - // to read the underlying image. Issue #157 - #define glyphlessSelectionOpacity 0.4 - -+// Returns whether x is between a and b or equal to a or b. -+// a and b don't need to be sorted. -+#define XBetweenAB(x,a,b) (!(((x) > (a) && (x) > (b)) || \ -+ ((x) < (a) && (x) < (b))) ? \ -+ true : false) -+ - namespace { - - inline bool isAscii7(Unicode uchar) -@@ -4411,11 +4417,37 @@ void TextSelectionSizer::visitLine (TextLine *line, - PDFRectangle *rect; - double x1, y1, x2, y2, margin; - -- margin = (line->yMax - line->yMin) / 8; -- x1 = line->edge[edge_begin]; -- y1 = line->yMin - margin; -- x2 = line->edge[edge_end]; -- y2 = line->yMax + margin; -+ switch (line->rot) { -+ default: -+ case 0: -+ margin = (line->yMax - line->yMin) / 8; -+ x1 = line->edge[edge_begin]; -+ x2 = line->edge[edge_end]; -+ y1 = line->yMin - margin; -+ y2 = line->yMax + margin; -+ break; -+ case 1: -+ margin = (line->xMax - line->xMin) / 8; -+ x1 = line->xMin - margin; -+ x2 = line->xMax + margin; -+ y1 = line->edge[edge_begin]; -+ y2 = line->edge[edge_end]; -+ break; -+ case 2: -+ margin = (line->yMax - line->yMin) / 8; -+ x1 = line->edge[edge_end]; -+ x2 = line->edge[edge_begin]; -+ y1 = line->yMin - margin; -+ y2 = line->yMax + margin; -+ break; -+ case 3: -+ margin = (line->xMax - line->xMin) / 8; -+ x1 = line->xMin - margin; -+ x2 = line->xMax + margin; -+ y1 = line->edge[edge_end]; -+ y2 = line->edge[edge_begin]; -+ break; -+ } - - rect = new PDFRectangle(floor(x1 * scale), floor(y1 * scale), ceil(x2 * scale), ceil(y2 * scale)); - list->push_back(rect); -@@ -4499,19 +4531,56 @@ void TextSelectionPainter::visitLine (TextLine *line, - { - double x1, y1, x2, y2, margin; - -- margin = (line->yMax - line->yMin) / 8; -- x1 = floor(line->edge[edge_begin]); -- y1 = floor(line->yMin - margin); -- x2 = ceil(line->edge[edge_end]); -- y2 = ceil(line->yMax + margin); -+ switch (line->rot) { -+ default: -+ case 0: -+ margin = (line->yMax - line->yMin) / 8; -+ x1 = line->edge[edge_begin]; -+ x2 = line->edge[edge_end]; -+ y1 = line->yMin - margin; -+ y2 = line->yMax + margin; -+ break; -+ case 1: -+ margin = (line->xMax - line->xMin) / 8; -+ x1 = line->xMin - margin; -+ x2 = line->xMax + margin; -+ y1 = line->edge[edge_begin]; -+ y2 = line->edge[edge_end]; -+ break; -+ case 2: -+ margin = (line->yMax - line->yMin) / 8; -+ x1 = line->edge[edge_end]; -+ x2 = line->edge[edge_begin]; -+ y1 = line->yMin - margin; -+ y2 = line->yMax + margin; -+ break; -+ case 3: -+ margin = (line->xMax - line->xMin) / 8; -+ x1 = line->xMin - margin; -+ x2 = line->xMax + margin; -+ y1 = line->edge[edge_end]; -+ y2 = line->edge[edge_begin]; -+ break; -+ } -+ -+ ctm.transform(x1, y1, &x1, &y1); -+ ctm.transform(x2, y2, &x2, &y2); - -- ctm.transform(line->edge[edge_begin], line->yMin - margin, &x1, &y1); -- ctm.transform(line->edge[edge_end], line->yMax + margin, &x2, &y2); -+ if (x1 < x2) { -+ x1 = floor(x1); -+ x2 = ceil(x2); -+ } else { -+ x1 = ceil(x1); -+ x2 = floor(x2); -+ } - -- x1 = floor(x1); -- y1 = floor(y1); -- x2 = ceil(x2); -- y2 = ceil(y2); -+ if (y1 < y2) { -+ y1 = floor(y1); -+ y2 = ceil(y2); -+ } else { -+ y1 = ceil(y1); -+ y2 = floor(y2); -+ } - - ictm.transform(x1, y1, &x1, &y1); - ictm.transform(x2, y2, &x2, &y2); -@@ -4589,17 +4658,26 @@ void TextWord::visitSelection(TextSelectionVisitor *visitor, - void TextWord::visitSelection(TextSelectionVisitor *visitor, const PDFRectangle *selection, SelectionStyle style) - { - int i, begin, end; -- double mid; -+ double mid, s1, s2; -+ -+ if (rot == 0 || rot == 2) { -+ s1 = selection->x1; -+ s2 = selection->x2; -+ } else { -+ s1 = selection->y1; -+ s2 = selection->y2; -+ } - - begin = len; - end = 0; - for (i = 0; i < len; i++) { - mid = (edge[i] + edge[i + 1]) / 2; -- if (selection->x1 < mid || selection->x2 < mid) -- if (i < begin) -- begin = i; -- if (mid < selection->x1 || mid < selection->x2) -- end = i + 1; -+ if (XBetweenAB (mid, s1, s2)) { -+ if (i < begin) -+ begin = i; -+ -+ end = i + 1; -+ } - } - - /* Skip empty selection. */ -@@ -4615,26 +4694,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor, - TextWord *p, *begin, *end, *current; - int i, edge_begin, edge_end; - PDFRectangle child_selection; -+ double s1, s2, p_min, p_max; -+ -+ if (rot == 0 || rot == 2) { -+ s1 = selection->x1; -+ s2 = selection->x2; -+ } else { -+ s1 = selection->y1; -+ s2 = selection->y2; -+ } - - begin = nullptr; - end = nullptr; - current = nullptr; - for (p = words; p != nullptr; p = p->next) { -+ if (rot == 0 || rot == 2) { -+ p_min = p->xMin; -+ p_max = p->xMax; -+ } else { -+ p_min = p->yMin; -+ p_max = p->yMax; -+ } -+ - if (blk->page->primaryLR) { -- if ((selection->x1 < p->xMax) || (selection->x2 < p->xMax)) -- if (begin == nullptr) -- begin = p; -+ if (((s1 < p_max) || (s2 < p_max)) && begin == nullptr) -+ begin = p; - -- if (((selection->x1 > p->xMin) || (selection->x2 > p->xMin)) && (begin != nullptr)) { -+ if (((s1 > p_min) || (s2 > p_min)) && begin != nullptr) { - end = p->next; - current = p; - } - } else { -- if ((selection->x1 > p->xMin) || (selection->x2 > p->xMin)) -- if (begin == nullptr) -- begin = p; -+ if (((s1 > p_min) || (s2 > p_min)) && begin == nullptr) -+ begin = p; - -- if (((selection->x1 < p->xMax) || (selection->x2 < p->xMax)) && (begin != nullptr)) { -+ if (((s1 < p_max) || (s2 < p_max)) && begin != nullptr) { - end = p->next; - current = p; - } -@@ -4650,23 +4740,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor, - - child_selection = *selection; - if (style == selectionStyleWord) { -- child_selection.x1 = begin ? begin->xMin : xMin; -- if (end && end->xMax != -1) { -- child_selection.x2 = current->xMax; -+ if (rot == 0 || rot == 2) { -+ child_selection.x1 = begin ? begin->xMin : xMin; -+ if (end && end->xMax != -1) { -+ child_selection.x2 = current->xMax; -+ } else { -+ child_selection.x2 = xMax; -+ } - } else { -- child_selection.x2 = xMax; -+ child_selection.y1 = begin ? begin->yMin : yMin; -+ if (end && end->yMax != -1) { -+ child_selection.y2 = current->yMax; -+ } else { -+ child_selection.y2 = yMax; -+ } - } - } - -+ if (rot == 0 || rot == 2) { -+ s1 = child_selection.x1; -+ s2 = child_selection.x2; -+ } else { -+ s1 = child_selection.y1; -+ s2 = child_selection.y2; -+ } -+ - edge_begin = len; - edge_end = 0; - for (i = 0; i < len; i++) { - double mid = (edge[i] + edge[i + 1]) / 2; -- if (child_selection.x1 < mid || child_selection.x2 < mid) -- if (i < edge_begin) -- edge_begin = i; -- if (mid < child_selection.x2 || mid < child_selection.x1) -- edge_end = i + 1; -+ if (XBetweenAB (mid, s1, s2)) { -+ if (i < edge_begin) -+ edge_begin = i; -+ -+ edge_end = i + 1; -+ } - } - - /* Skip empty selection. */ --- -1.8.4.2 - diff --git a/poppler.spec b/poppler.spec index 7f2bc20..bd701fb 100644 --- a/poppler.spec +++ b/poppler.spec @@ -3,7 +3,7 @@ Summary: PDF rendering library Name: poppler -Version: 21.08.0 +Version: 22.01.0 Release: 1%{?dist} License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT URL: http://poppler.freedesktop.org/ @@ -11,9 +11,6 @@ Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz # git archive --prefix test/ Source1: %{name}-test-%{test_date}-%{test_sha}.tar.xz -# https://bugzilla.redhat.com/show_bug.cgi?id=1185007 -Patch0: poppler-0.30.0-rotated-words-selection.patch - Patch1: poppler-0.90.0-position-independent-code.patch Patch3: poppler-21.01.0-glib-introspection.patch @@ -165,7 +162,7 @@ test "$(pkg-config --modversion poppler-qt5)" = "%{version}" %files %doc README.md %license COPYING -%{_libdir}/libpoppler.so.112* +%{_libdir}/libpoppler.so.117* %files devel %{_libdir}/pkgconfig/poppler.pc @@ -212,6 +209,10 @@ test "$(pkg-config --modversion poppler-qt5)" = "%{version}" %{_mandir}/man1/* %changelog +* Thu Jan 13 2022 Marek Kasik - 22.01.0-1 +- Update to 22.01.0 +- Resolves: #2000346 + * Mon Aug 2 2021 Marek Kasik - 21.08.0-1 - Update to 21.08.0 - Resolves: #1923798, #1988844 diff --git a/sources b/sources index faf8fa8..94705b6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ SHA512 (poppler-test-2021-01-11-03a4b9eb854a06a83c465e82de601796c458bbe9.tar.xz) = 257133b261b07076d3207456e3edad324e29911a45a960d4953eb84813ac175bc65be713a10454b52b96711870fcbeee533fd0fd7de8550a87390e833b1af8c5 -SHA512 (poppler-21.08.0.tar.xz) = 266583279fb5c6b5300d23f8ba5b9da3e1f475fe21341a82ed7350dd9e321e243f3ef051944006c4f242c2d63a8c46bcda565a56017eb3a68caa5680ce719211 +SHA512 (poppler-22.01.0.tar.xz) = c6ea908a9188483ca588ac81d3e92dd15a405f90d36cc7059e618c8a7e3e9faeda82717aba5df34adb4a0a94e2fbecd472acec44972272349cc8d5a57b7405d1