poppler/Annot.cc |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

New commits:
commit 39882dfecdccc00db353946a31d395582ee37022
Author: José Aliste <[email protected]>
Date:   Wed Feb 27 01:33:38 2013 +0100

    Correct rendering of underline and strike out annotations
    
    Current code assumes that the text to underline or strike out is horizontal.
    Fixes bug #61518

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index dae0f62..064b550 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -23,7 +23,7 @@
 // Copyright (C) 2008 Michael Vrable <[email protected]>
 // Copyright (C) 2008 Hugo Mercier <[email protected]>
 // Copyright (C) 2009 Ilya Gorenbein <[email protected]>
-// Copyright (C) 2011 José Aliste <[email protected]>
+// Copyright (C) 2011, 2013 José Aliste <[email protected]>
 // Copyright (C) 2012 Fabio D'Urso <[email protected]>
 // Copyright (C) 2012 Thomas Freitag <[email protected]>
 // Copyright (C) 2012 Tobias Koenig <[email protected]>
@@ -3601,14 +3601,15 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
       appearBuf->append ("[] 0 d 1 w\n");
 
       for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) {
-        double x1, x2, y3;
+       double x3, y3, x4, y4;
 
-       x1 = quadrilaterals->getX1(i);
-       x2 = quadrilaterals->getX2(i);
+       x3 = quadrilaterals->getX3(i);
        y3 = quadrilaterals->getY3(i);
+       x4 = quadrilaterals->getX4(i);
+       y4 = quadrilaterals->getY4(i);
 
-       appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y3);
-       appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y3);
+       appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x3, y3);
+       appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x4, y4);
        appearBuf->append ("S\n");
       }
       break;
@@ -3620,17 +3621,21 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
       appearBuf->append ("[] 0 d 1 w\n");
 
       for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) {
-        double x1, y1, x2, y3;
-       double h2;
+       double x1, y1, x2, y2;
+       double x3, y3, x4, y4;
 
        x1 = quadrilaterals->getX1(i);
        y1 = quadrilaterals->getY1(i);
        x2 = quadrilaterals->getX2(i);
+       y2 = quadrilaterals->getY2(i);
+
+       x3 = quadrilaterals->getX3(i);
        y3 = quadrilaterals->getY3(i);
-       h2 = (y1 - y3) / 2.0;
+       x4 = quadrilaterals->getX4(i);
+       y4 = quadrilaterals->getY4(i);
 
-       appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y3+h2);
-       appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y3+h2);
+       appearBuf->appendf ("{0:.2f} {1:.2f} m\n", (x1+x3)/2., (y1+y3)/2.);
+       appearBuf->appendf ("{0:.2f} {1:.2f} l\n", (x2+x4)/2., (y2+y4)/2.);
        appearBuf->append ("S\n");
       }
       break;
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to