[SCM] okular packaging branch, master, updated. debian/4.8.4-2-8-gf73581b

Lisandro Damián Nicanor Pérez lisandro at alioth.debian.org
Tue Nov 27 23:40:43 UTC 2012


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-sc/okular.git;a=commitdiff;h=21b8f79

The following commit has been merged in the master branch:
commit 21b8f799b3ce1eaa5e116fb3328089a15e9ea7a6
Author: Lisandro Damián Nicanor Pérez Meyer <perezmeyer at gmail.com>
Date:   Tue Nov 27 20:37:32 2012 -0300

    Backport upstream commit 91e463 to fix word detection in DVI docs.
---
 debian/changelog                                   |    4 +
 .../patches/fix_word_detection_with_dvi_docs.diff  |  153 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 3 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1aba7de..8232e40 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,10 @@ okular (4:4.8.4-3) UNRELEASED; urgency=low
     patch upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch.
     (Closes: #686642)
 
+  [ Lisandro Damián Nicanor Pérez Meyer ]
+  * Backport upstream commit 91e46331fd7901705a69323c75de84e2467416dd to restore
+    word detection in DVI documents. Thanks Luigi Toscano.
+
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Mon, 09 Jul 2012 15:24:28 +0200
 
 okular (4:4.8.4-2) unstable; urgency=low
diff --git a/debian/patches/fix_word_detection_with_dvi_docs.diff b/debian/patches/fix_word_detection_with_dvi_docs.diff
new file mode 100644
index 0000000..38e57d7
--- /dev/null
+++ b/debian/patches/fix_word_detection_with_dvi_docs.diff
@@ -0,0 +1,153 @@
+commit 91e46331fd7901705a69323c75de84e2467416dd
+Author: Luigi Toscano <luigi.toscano at tiscali.it>
+Date:   Tue Nov 27 00:59:57 2012 +0100
+
+    Fix word detection for DVI documents
+    
+    This patch attempts to restore the functionalities broken by some changes
+    (maybe the text column selection code, it was broken also in 4.7).
+    
+    Text search and text selection work (almost) properly again.
+    
+    It uses a bit of heuristics to identify the end of a word and merge the
+    boxes which enclose each character of a word (so that
+    char_x.right==char_{x+1}.left).
+    It also tries to recognize if there is a newline ("after_space") after
+    that a space is found.
+    
+    BUG: 302004
+    REVIEW: 107429
+    FIXED-IN: 4.9.4
+
+diff --git a/generators/dvi/dviRenderer_draw.cpp b/generators/dvi/dviRenderer_draw.cpp
+index b816353..b622e79 100644
+--- a/generators/dvi/dviRenderer_draw.cpp
++++ b/generators/dvi/dviRenderer_draw.cpp
+@@ -275,7 +275,11 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+   currinf.fontp        = NULL;
+   currinf.set_char_p   = &dviRenderer::set_no_char;
+ 
++  int last_space_index = 0;
++  bool space_encountered = false;
++  bool after_space = false;
+   for (;;) {
++    space_encountered = false;
+     ch = readUINT8();
+     if (ch <= (unsigned char) (SETCHAR0 + 127)) {
+       (this->*currinf.set_char_p)(ch, ch);
+@@ -404,8 +408,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false) &&
+               (currinf.fontp != 0) &&
+               ((RRtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (RRtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0))
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0)) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += ((long) (RRtmp *  current_dimconv));
+           break;
+ 
+@@ -419,8 +425,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false) &&
+               (currinf.fontp != 0) &&
+               ((WWtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (WWtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0) )
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0) ) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += currinf.data.w;
+           break;
+ 
+@@ -434,8 +442,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false)  &&
+               (currinf.fontp != 0) &&
+               ((XXtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (XXtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0))
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0)) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += currinf.data.x;
+           break;
+ 
+@@ -451,6 +461,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+                 (currentlyDrawnPage->textBoxList.size() > 0)) {
+               word_boundary_encountered = true;
+               line_boundary_encountered = true;
++              space_encountered = true;
+               if (abs(DDtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+                 currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '
';
+             }
+@@ -472,6 +483,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+               (currentlyDrawnPage->textBoxList.size() > 0)) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+             if (abs(YYtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+               currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '
';
+           }
+@@ -492,6 +504,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+               (currentlyDrawnPage->textBoxList.size() > 0)) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+             if (abs(ZZtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+               currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '
';
+           }
+@@ -526,6 +539,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if (is_vfmacro == false) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+           }
+           a = readUINT(ch - XXX1 + 1);
+           if (a > 0) {
+@@ -562,6 +576,44 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           return;
+         } /* end switch*/
+       } /* end else (ch not a SETCHAR or FNTNUM) */
++
++#ifdef DEBUG_RENDER
++    if (currentlyDrawnPage->textBoxList.size() > 0)
++      kDebug(kvs::dvi) << "Element:"
++                       << currentlyDrawnPage->textBoxList.last().box
++                       << currentlyDrawnPage->textBoxList.last().text
++                       << " ? s:" << space_encountered
++                       << " / nl:" << line_boundary_encountered
++                       << " / w:" << word_boundary_encountered
++                       << ", " << last_space_index << "/"
++                       << currentlyDrawnPage->textBoxList.size();
++#endif
++
++    /* heuristic to properly detect newlines; a space is needed */
++    if (after_space &&
++        line_boundary_encountered && word_boundary_encountered) {
++      if (currentlyDrawnPage->textBoxList.last().text.endsWith('
'))
++         currentlyDrawnPage->textBoxList.last().text.chop(1);
++      currentlyDrawnPage->textBoxList.last().text += " 
";
++      after_space = false;
++    }
++
++    /* a "space" has been found and there is some (new) character
++       in the array */
++    if (space_encountered &&
++        (currentlyDrawnPage->textBoxList.size() > last_space_index)) {
++      QString lastword(currentlyDrawnPage->textBoxList[last_space_index].text);
++      for (int lidx = last_space_index+1; lidx<currentlyDrawnPage->textBoxList.size(); ++lidx) {
++        // merge two adjacent boxes which are part of the same word
++        lastword += currentlyDrawnPage->textBoxList[lidx].text;
++        currentlyDrawnPage->textBoxList[lidx-1].box.setRight(currentlyDrawnPage->textBoxList[lidx].box.x());
++      }
++#ifdef DEBUG_RENDER
++      kDebug(kvs::dvi) << "space encountered: '" << lastword << "'";
++#endif
++      last_space_index = currentlyDrawnPage->textBoxList.size();
++      after_space = true;
++    }
+   } /* end for */
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 8bc2492..d53b922 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch
+fix_word_detection_with_dvi_docs.diff

-- 
okular packaging



More information about the pkg-kde-commits mailing list