diff options
author | wl <wl> | 2012-08-31 12:17:33 +0000 |
---|---|---|
committer | wl <wl> | 2012-08-31 12:17:33 +0000 |
commit | 847b504be937b13d472024555b5abd7f094aa739 (patch) | |
tree | 6b6a75bb27ec545a8cdf4c54f698a94675a59b05 /src/devices/gropdf/pdfmom.pl | |
parent | a529116ae6922d775b4270adcdb2c0f227831957 (diff) | |
download | groff-847b504be937b13d472024555b5abd7f094aa739.tar.gz |
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.
Diffstat (limited to 'src/devices/gropdf/pdfmom.pl')
-rw-r--r-- | src/devices/gropdf/pdfmom.pl | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl new file mode 100644 index 00000000..a03bc83d --- /dev/null +++ b/src/devices/gropdf/pdfmom.pl @@ -0,0 +1,82 @@ +#!@PERLPATH@ -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 <deri@chuzzlewit.demon.co.uk> +# +# 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 @VERSION@\n"; + 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; +} + |