[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/plugins/dvi
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-07-01 13:01:10
Message-ID: 1151758870.831229.16204.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 556731 by whuss:

Port of commit 556729:

Merge hyperlinks that point to the same target and have the same baseline. 
This fixes a problem with german "Umlauten" that caused links to be broken
into two overlapping parts.

 M  +42 -0     dviRenderer.cpp  


--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/dviRenderer.cpp #556730:556731
@@ -184,6 +184,48 @@
   }
   page->setImage(img);
 
+  // Postprocess hyperlinks
+  // Without that, based on the way TeX draws certain characters like german "Umlaute",
+  // some hyperlinks would be broken into two overlapping parts, in the middle of a word.
+  Q3ValueVector<Hyperlink>::iterator i = page->hyperLinkList.begin();
+  Q3ValueVector<Hyperlink>::iterator j;
+  while (i != page->hyperLinkList.end())
+  {
+    // Iterator j always points to the element after i.
+    j = i;
+    j++;
+
+    if (j == page->hyperLinkList.end())
+      break;
+
+    Hyperlink& hi = *i;
+    Hyperlink& hj = *j;
+
+    bool merged = false;
+
+    // Merge all hyperlinks that point to the same target, and have the same baseline.
+    while (hi.linkText == hj.linkText && hi.baseline == hj.baseline)
+    {
+      merged = true;
+      hi.box = hi.box.unite(hj.box);
+
+      j++;
+      if (j == page->hyperLinkList.end())
+        break;
+
+      hj = *j;
+    }
+
+    if (merged)
+    {
+      i = page->hyperLinkList.erase(++i, j);
+    }
+    else
+    {
+      i++;
+    }
+  }
+
   page->isEmpty = false;
   if (errorMsg.isEmpty() != true) {
     KMessageBox::detailedError(parentWidget,
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic