groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/01: Expose more attributes of pdfnotes


From: Deri James
Subject: [groff] 01/01: Expose more attributes of pdfnotes
Date: Thu, 12 Dec 2024 07:05:11 -0500 (EST)

deri pushed a commit to branch master
in repository groff.

commit e57fcf3377c00ee0034ec5c396eeea334049855c
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Thu Dec 12 12:03:56 2024 +0000

    Expose more attributes of pdfnotes
    
    * tmac/pdfpic: Add registers PDFNOTE.COLO(U)R and
    PDFNOTE.OPACITY which affect the rendering of the note.
    
    * src/devices/gropdf/gropdf.pl: Add creation date. If no window title
    given but the author's name has previously been given with .pdfinfo
    use the name as the title.
    
    Fixes <https://savannah.gnu.org/bugs/index.php?66556>.
---
 ChangeLog                    | 13 +++++++++++++
 src/devices/gropdf/gropdf.pl |  5 +++++
 tmac/pdf.tmac                | 23 ++++++++++++++++++++++-
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e2abd943e..7c7228e4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-12-12  Deri James  <deri@chuzzlewit.myzen.co.uk>
+
+       Expose more attributes of pdfnotes
+
+       * tmac/pdfpic: Add registers PDFNOTE.COLO(U)R and
+       PDFNOTE.OPACITY which affect the rendering of the note.
+
+       * src/devices/gropdf/gropdf.pl: Add creation date. If no window title
+       given but the author's name has previously been given with .pdfinfo
+       use the name as the title.
+
+       Fixes <https://savannah.gnu.org/bugs/index.php?66556>.
+
 2024-12-10  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [src/devices, tmac]: Improve build modularity.
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index fcad03c6f..0d2af6c60 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1508,6 +1508,11 @@ sub do_x
                    FixPDFColour($annot->{DATA});
                    $annot->{DATA}->{Dest}=UTFName($annot->{DATA}->{Dest}) if 
exists($annot->{DATA}->{Dest});
                    
$annot->{DATA}->{A}->{URI}=URIName($annot->{DATA}->{A}->{URI}) if 
exists($annot->{DATA}->{A}->{URI});
+                   if (exists($annot->{DATA}->{Subtype}) and 
$annot->{DATA}->{Subtype} eq '/Text')
+                   {
+                       $annot->{DATA}->{M}="($dt)";
+                       $annot->{DATA}->{T}=$info{Author} if 
!exists($annot->{DATA}->{T}) and exists($info{Author});
+                   }
                    push(@PageAnnots,$annotno);
                }
                elsif ($pdfmark=~m/(.+) \/OUT\s*$/)
diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
index 234852c5a..4ee4809b1 100644
--- a/tmac/pdf.tmac
+++ b/tmac/pdf.tmac
@@ -144,6 +144,23 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .\"
 .ds PDFLB \\012
 .\"
+.\" "PDFNOTE.COLOUR" must be set to a sequence of three values,
+.\" each in the range 0.0 .. 1.0, representing the red, green, and
+.\" blue components of the colour specification in the RGB colour
+.\" domain, which is shared by "groff" and the PDF readers.
+.\"
+.ds PDFNOTE.COLOUR   1.00 1.00 0.00
+.\"
+.\" Accommodate users who prefer the American spelling, COLOR, to
+.\" the British spelling, COLOUR.
+.\"
+.als PDFNOTE.COLOR       PDFNOTE.COLOUR
+.\"
+.\" "PDFNOTE.OPACITY" set the opacity of the note icon (not the actual
+.\" popup window which is always opaque). Range 0->1 (opaque).
+.\"
+.ds PDFNOTE.OPACITY 0.60
+.\"
 .de pdfnote
 .\" ----------------------------------------------------------------------
 .\" Usage:
@@ -169,10 +186,14 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .\"
 .\" Emit the note, and clean up
 .\"
-.   pdfmark \\*[pdf:note.instance] /Subtype /Text /Contents (\\$*) /ANN
+.   pdfmark \\*[pdf:note.instance] /Subtype /Text /Contents (\\$*) /Color 
[\\*[PDFNOTE.COLOUR]] /CA \\*[PDFNOTE.OPACITY] /ANN
 .   rm pdf:note.instance
 .   rr pdf:note.argc
 ..
+.\" The -T flag gives a title to the note window, if not used but a
+.\" document author has been given previously, the author's name is
+.\" used as the window title.
+.\"
 .de pdf:note-T
 .nr pdf:note.argc 2
 .as pdf:note.instance " /Title (\\$2)



reply via email to

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