groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ChangeLog Makefile.in src/devices/gropdf/...


From: Werner LEMBERG
Subject: [Groff-commit] groff ChangeLog Makefile.in src/devices/gropdf/...
Date: Fri, 31 Aug 2012 12:17:35 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Changes by:     Werner LEMBERG <wl>     12/08/31 12:17:35

Modified files:
        .              : ChangeLog Makefile.in 
        src/devices/gropdf: Makefile.sub gropdf.pl 
Added files:
        src/devices/gropdf: pdfmom.man pdfmom.pl 

Log message:
        Add `pdfmom' to handle mom documents with gropdf.
        
        * Makefile.in (OTHERDIRS): Move contrib/mom to be run after
        devices/gropdf.
        
        * src/devices/gropdf/gropdf.pl: Various fixes:
        
          . Correct image scaling issue.
          . Handle relative horizontal movement 'h' followed by absolute
            vertical movement 'V'.
          . Correct handling of track kerning.
        
        * src/devices/gropdf/pdfmom.pl: New wrapper for mom (pdfmom)
        using gropdf or grops driver.
        * src/devices/gropdf/pdfmom.man: New man page.
        * src/devices/gropdf/Makefile.sub: Updated to handle new files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1349&r2=1.1350
http://cvs.savannah.gnu.org/viewcvs/groff/Makefile.in?cvsroot=groff&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/groff/src/devices/gropdf/Makefile.sub?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/src/devices/gropdf/gropdf.pl?cvsroot=groff&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/groff/src/devices/gropdf/pdfmom.man?cvsroot=groff&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/groff/src/devices/gropdf/pdfmom.pl?cvsroot=groff&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1349
retrieving revision 1.1350
diff -u -b -r1.1349 -r1.1350
--- ChangeLog   31 Aug 2012 11:15:32 -0000      1.1349
+++ ChangeLog   31 Aug 2012 12:17:33 -0000      1.1350
@@ -1,3 +1,38 @@
+2012-08-31  Deri James  <address@hidden>
+
+       Add `pdfmom' to handle mom documents with gropdf.
+
+       * Makefile.in (OTHERDIRS): Move contrib/mom to be run after
+       devices/gropdf.
+
+       * src/devices/gropdf/gropdf.pl: Various fixes:
+
+         . Correct image scaling issue.
+         . Handle relative horizontal movement 'h' followed by absolute
+           vertical movement 'V'.
+         . Correct handling of track kerning.
+
+       * src/devices/gropdf/pdfmom.pl: New wrapper for mom (pdfmom)
+       using gropdf or grops driver.
+       * src/devices/gropdf/pdfmom.man: New man page.
+       * src/devices/gropdf/Makefile.sub: Updated to handle new files.
+
+2012-08-31  Deri James  <address@hidden>
+
+       * Makefile.in (OTHERDIRS): Move contrib/mom to be run after
+       devices/gropdf.
+
+       * src/devices/gropdf/gropdf.pl: Various fixes:
+
+         . Correct image scaling issue.
+         . Handle relative horizontal movement 'h' followed by absolute
+           vertical movement 'V'.
+         . Correct handling of track kerning.
+
+       * src/devices/gropdf/pdfmom.pl: New wrapper for mom (pdfmom)
+       using gropdf or grops driver.
+       * src/devices/gropdf/pdfmom.man: New man page.
+       * src/devices/gropdf/Makefile.sub: Updated to handle new files.
 2012-08-31  Julien Moutinho  <address@hidden>
 
        * tmac/www.tmac (www-push-li): Fix indentation.

Index: Makefile.in
===================================================================
RCS file: /cvsroot/groff/groff/Makefile.in,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- Makefile.in 26 Feb 2012 23:40:11 -0000      1.121
+++ Makefile.in 31 Aug 2012 12:17:33 -0000      1.122
@@ -607,7 +607,8 @@
   font/devlatin1 \
   font/devutf8 \
   font/devcp1047
-# `doc' must be processed before `contrib/pdfmark'.
+# `doc' must be processed before `contrib/pdfmark',
+# pdf stuff must be processed before `contrib/mom
 OTHERDIRS=\
   man \
   tmac \
@@ -621,11 +622,11 @@
   contrib/eqn2graph \
   contrib/grap2graph \
   contrib/groffer \
-  contrib/mom \
   contrib/hdtbl \
   contrib/pdfmark \
   src/devices/gropdf \
   font/devpdf \
+  contrib/mom \
   contrib/gdiffmk
   
 # OTHERDIRS is handled specially in the `$(TARGETS)' rule to avoid

Index: src/devices/gropdf/Makefile.sub
===================================================================
RCS file: /cvsroot/groff/groff/src/devices/gropdf/Makefile.sub,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/devices/gropdf/Makefile.sub     20 May 2012 13:58:10 -0000      1.2
+++ src/devices/gropdf/Makefile.sub     31 Aug 2012 12:17:34 -0000      1.3
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011-2012 Free Software Foundation, Inc.
 #      Written by Deri James <address@hidden>
 #
 # This file is part of groff.
@@ -17,10 +17,12 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 MAN1=\
-  gropdf.n
+  gropdf.n \
+  pdfmom.n
 
 CMDFILES=\
-  gropdf
+  gropdf \
+  pdfmom
 
 MOSTLYCLEANADD=\
   gropdf \
@@ -30,7 +32,7 @@
 RM=rm -f
 
 
-all: gropdf
+all: gropdf pdfmom
 
 
 gropdf: gropdf.pl $(SH_DEPS_SED_SCRIPT)
@@ -42,6 +44,13 @@
            -e "s|@RT_SEP@|$(RT_SEP)|" $(srcdir)/gropdf.pl >$@
        chmod +x $@
 
+pdfmom: pdfmom.pl $(SH_DEPS_SED_SCRIPT)
+       $(RM) $@
+       sed -f $(SH_DEPS_SED_SCRIPT) \
+           -e "s|@VERSION@|$(version)$(revision)|" \
+           -e "s|@PERLPATH@|$(PERLPATH)|" $(srcdir)/pdfmom.pl >$@
+       chmod +x $@
+
 install_data:
        -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
        for f in $(CMDFILES); do \

Index: src/devices/gropdf/gropdf.pl
===================================================================
RCS file: /cvsroot/groff/groff/src/devices/gropdf/gropdf.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- src/devices/gropdf/gropdf.pl        13 Jun 2012 06:37:41 -0000      1.7
+++ src/devices/gropdf/gropdf.pl        31 Aug 2012 12:17:34 -0000      1.8
@@ -907,13 +907,13 @@
                {
                    IsGraphic();
                    my $bbox=$incfil{$fil}->[1];
-                   my $xscale=$wid/($bbox->[2]-$bbox->[0]+1);
-                   my 
$yscale=($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1]+1));
+                   my $xscale=$wid/($bbox->[2]-$bbox->[0]);
+                   my $yscale=($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1]));
                    $xscale=($wid<=0)?$yscale:$xscale;
                    $xscale=$yscale if $yscale < $xscale;
                    $yscale=$xscale if $xscale < $yscale;
-                   $wid=($bbox->[2]-$bbox->[0]+1)*$xscale;
-                   $hgt=($bbox->[3]-$bbox->[1]+1)*$yscale;
+                   $wid=($bbox->[2]-$bbox->[0])*$xscale;
+                   $hgt=($bbox->[3]-$bbox->[1])*$yscale;
 
                    if ($flag eq '-C' and $ll > $wid)
                    {
@@ -2978,7 +2978,7 @@
 
     }
 
-    $nomove=$pendmv=0;
+#    $nomove=$pendmv=0;
     $poschg=1;
 }
 
@@ -2997,6 +2997,7 @@
 {
     my $txt=shift;
     my $w=0;
+    my $ck=0;
 
     foreach my $c (split('',$txt))
     {
@@ -3005,7 +3006,9 @@
        $w+=$widtbl->[$cn];
     }
 
-    return($w/$unitwidth);
+    $ck=length($txt)*$curkern;
+
+    return(($w/$unitwidth)+$ck);
 }
 
 sub do_t

Index: src/devices/gropdf/pdfmom.man
===================================================================
RCS file: src/devices/gropdf/pdfmom.man
diff -N src/devices/gropdf/pdfmom.man
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/devices/gropdf/pdfmom.man       31 Aug 2012 12:17:34 -0000      1.1
@@ -0,0 +1,140 @@
+.ig
+Copyright (C) 2012
+  Free Software Foundation, Inc.
+written by Deri James <address@hidden>
+and Peter Schaffter <address@hidden)
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be included in
+translations approved by the Free Software Foundation instead of in
+the original English.
+..
+.
+.TH PDFMOM @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
+.
+.
+.SH NAME
+.
+pdfmom \- Produce PDF documents using the mom macro set
+.
+.
+.SH SYNOPSIS
+.
+.SY pdfmom
+.OP \-Tps "\fR[pdfroff options]"
+[groff options]
+.I files .\|.\|.
+.YS
+.
+.SY pdfmom
+.OP \-Tpdf
+[groff options]
+.I files .\|.\|.
+.YS
+.
+.
+.SH DESCRIPTION
+.
+.B pdfmom
+is a wrapper around
+.B groff
+that facilitates the production of PDF documents from files
+formatted with the mom macros.
+.
+.P
+.B pdfmom
+prints to stdout, so output must be redirected to a destination
+file.  The size of the final PDF can be reduced by piping the output
+through
+.BR ps2pdf .
+.
+.P
+If called with the
+.B \-Tpdf
+option (which is the default),
+.B pdfmom
+processes files using groff's native PDF driver,
+.BR gropdf .
+If
+.B \-Tps
+is given, processing is passed over to
+.BR pdfroff ,
+which uses
+.BR groff 's
+PostScript driver.
+In either case, multiple runs of the source file are peformed in
+order to satisfy any forward references in the document.
+.
+.P
+.B pdfmom
+accepts all the same options as
+.BR groff .
+If
+.B \-Tps
+is given, the options associated with
+.B pdfroff
+are accepted as well.
+Please note that when
+.B pdfmom
+calls
+.BR pdfroff ,
+the
+.
+.P
+.RS
+.B -mpdfmark -mom --no-toc
+.RE
+.
+.P
+options are implied and should not be given on the
+command line.
+Equally, it is not necessary to supply the
+.B -mom
+or
+.B "-m\~mom"
+options when
+.B \-Tps
+is absent.
+.
+.P
+PDF integration with the
+.B mom
+macros is discussed in full in the PDF manual,
+.IR "Producing PDFs with groff and mom" .
+.
+.
+.SH BUGS
+.
+.B pdfmom
+sometimes issues warnings of the type
+.
+.P
+.RS 2
+\&.\|.\|.:
+.B can't transparently output node at top level
+.RE
+.
+.P
+This is more of an annoyance than a bug, and may safely be ignored.
+.
+.
+.SH "SEE ALSO"
+.
+.BR groff (@MAN1EXT@),
+.BR pdfroff (@MAN1EXT@),
+.BR ps2pdf (@MAN1EXT@)
+.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:

Index: src/devices/gropdf/pdfmom.pl
===================================================================
RCS file: src/devices/gropdf/pdfmom.pl
diff -N src/devices/gropdf/pdfmom.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/devices/gropdf/pdfmom.pl        31 Aug 2012 12:17:34 -0000      1.1
@@ -0,0 +1,82 @@
address@hidden@ -w
+#
+#      pdfmom          : Frontend to run groff -mom to produce PDFs
+#      Deri James      : Friday 16 Mar 2012
+#
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#      Written by Deri James <address@hidden>
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use strict;
+my @cmd;
+my $dev='pdf';
+
+while (my $c=shift)
+{
+    if (substr($c,0,2) eq '-T')
+    {
+       if (length($c) > 2)
+       {
+           $dev=substr($c,2);
+       }
+       else
+       {
+           $dev=shift;
+       }
+
+       next;
+    }
+    elsif ($c eq '-z' or $c eq '-Z')
+    {
+       $dev=$c;
+       next;
+    }
+
+    elsif ($c eq '-v')
+    {
+       print "GNU pdfmom (groff) version @address@hidden";
+       exit;
+    }
+
+    push(@cmd,$c);
+}
+
+my $cmdstring=join(' ',@cmd);
+
+if ($dev eq 'pdf')
+{
+    system("groff -Tpdf -dPDF.EXPORT=1 -mom -z $cmdstring 2>&1 | grep '^.ds' | 
groff -Tpdf -mom - $cmdstring");
+}
+elsif ($dev eq 'ps')
+{
+    system("pdfroff -mpdfmark -mom --no-toc $cmdstring");
+}
+elsif ($dev eq '-z') # pseudo dev - just compile for warnings
+{
+    system("groff -Tpdf -mom -z $cmdstring");
+}
+elsif ($dev eq '-Z') # pseudo dev - produce troff output
+{
+    system("groff -Tpdf -mom -Z $cmdstring");
+}
+else
+{
+    print STDERR "Not compatible with device '-T $dev'\n";
+    exit 1;
+}
+



reply via email to

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