groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 09/21: [gropdf]: Fix Savannah #63380.


From: G. Branden Robinson
Subject: [groff] 09/21: [gropdf]: Fix Savannah #63380.
Date: Fri, 18 Nov 2022 13:47:52 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 0ce521b5fce66f8065f1b7d0dc721fd44d8ae40b
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Wed Nov 16 22:02:49 2022 +0000

    [gropdf]: Fix Savannah #63380.
    
    * src/devices/gropdf/gropdf.pl: Fix incorrect hotspot placement if page
      is in landscape orientation.
    
      (FixRect): Perform coordinate transform if page is rotated.
    
      (Rotate): New function performs relevant trigonometry.
    
    Fixes <https://savannah.gnu.org/bugs/?63380>.  Thanks to Blake McBride
    for the report.
---
 ChangeLog                    | 10 ++++++++++
 src/devices/gropdf/gropdf.pl | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 26c0fd0c4..3c0723d17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-11-16  Deri James  <deri@chuzzlewit.myzen.co.uk>
+
+       * src/devices/gropdf/gropdf.pl: Fix incorrect hotspot placement
+       if page is in landscape orientation.
+       (FixRect): Perform coordinate transform if page is rotated.
+       (Rotate): New function performs relevant trigonometry.
+
+       Fixes <https://savannah.gnu.org/bugs/?63380>.  Thanks to Blake
+       McBride for the report.
+
 2022-11-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/e.tmac: Integrate better with papersize.tmac by no longer
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 07c65b8ea..739dad4e4 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1491,6 +1491,22 @@ sub FixRect
     return if !defined($rect);
     $rect->[1]=GraphY($rect->[1]);
     $rect->[3]=GraphY($rect->[3]);
+
+    if ($rot)
+    {
+       ($rect->[0],$rect->[1])=Rotate($rect->[0],$rect->[1]);
+       ($rect->[2],$rect->[3])=Rotate($rect->[2],$rect->[3]);
+    }
+}
+
+sub Rotate
+{
+    my ($tx,$ty)=(@_);
+    my $theta=rad($rot);
+
+    ($tx,$ty)=(d3($tx * cos(-$theta) - $ty * sin(-$theta)),
+              d3($tx * sin( $theta) + $ty * cos( $theta)));
+    return($tx,$ty);
 }
 
 sub GetPoints



reply via email to

[Prev in Thread] Current Thread [Next in Thread]