poppler/TextOutputDev.cc |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 7578e04f8d48d307e82764e05ab13f6612180641
Author: Nelson Benítez León <[email protected]>
Date:   Sun Feb 28 23:44:43 2021 -0400

    TextSelectionDumper: fix word order for RTL text
    
    This is used by glib backend (Evince).
    
    Fixes issue #53

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index a7e9d1ec..ea12b468 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -4349,9 +4349,13 @@ void TextSelectionDumper::finishLine()
         lines = (std::vector<TextWordSelection *> **)grealloc(lines, linesSize 
* sizeof(std::vector<TextWordSelection *> *));
     }
 
-    if (words && words->size() > 0)
+    if (words && words->size() > 0) {
+        // Reverse word order for RTL text. Fixes #53 for glib backend (Evince)
+        if (!page->primaryLR)
+            std::reverse(words->begin(), words->end());
+
         lines[nLines++] = words;
-    else if (words)
+    } else if (words)
         delete words;
     words = nullptr;
 }
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to