summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwl <wl>2011-08-10 18:22:58 +0000
committerwl <wl>2011-08-10 18:22:58 +0000
commita8a28d87bf78636f437d06712f80574f0c62dadb (patch)
tree4b32e3e506d127d6ac7142d62cdfbde84fc952e8
parent0938acbb014e059439eabcd1688728e3bb00edaf (diff)
downloadgroff-a8a28d87bf78636f437d06712f80574f0c62dadb.tar.gz
[gropdf] Minor updates and fixes.
* src/devices/gropdf/gropdf.pl: Change command line option `-fy' to `-y' for consistency. Better support for Windows platform. (do_x): Handle keywords `pagename' and `switchtopage'. * doc/groff.texinfo, src/devices/gropdf/gropdf.man: Updated. * font/devpdf/Foundry: Renamed to... * font/devpdf/Foundry.in: This. Add default alias font names. * font/devpdf/util/BuildFoundries.pl: This is now an installation helper script and gets not longer installed. Support alternative font file names (separated with `!'). * font/devpdf/Makefile.sub: Fixes to work with a separate build directory. Font files are now build at `make' time; this makes `test-groff' work with -Tpdf. * font/devpdf/util/Makefile.sub: Removed. * Makefile.in (DEVDIRS, OTHERDIRS, EXTRADIRS): Handle devpdf specially.
-rw-r--r--ChangeLog29
-rw-r--r--Makefile.in3
-rw-r--r--doc/groff.texinfo2
-rw-r--r--font/devpdf/Makefile.sub81
-rw-r--r--font/devpdf/util/BuildFoundries.pl39
-rw-r--r--src/devices/gropdf/gropdf.man11
-rw-r--r--src/devices/gropdf/gropdf.pl101
7 files changed, 206 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a39f04b..6cb1f22d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2011-08-10 Deri James <deri@chuzzlewit.demon.co.uk>
+
+ [gropdf] Minor updates and fixes.
+
+ * src/devices/gropdf/gropdf.pl: Change command line option `-fy' to
+ `-y' for consistency.
+ Better support for Windows platform.
+ (do_x): Handle keywords `pagename' and `switchtopage'.
+
+ * doc/groff.texinfo, src/devices/gropdf/gropdf.man: Updated.
+
+ * font/devpdf/Foundry: Renamed to...
+ * font/devpdf/Foundry.in: This.
+ Add default alias font names.
+
+ * font/devpdf/util/BuildFoundries.pl: This is now an installation
+ helper script and gets not longer installed.
+ Support alternative font file names (separated with `!').
+
+ * font/devpdf/Makefile.sub: Fixes to work with a separate build
+ directory.
+ Font files are now build at `make' time; this makes `test-groff'
+ work with -Tpdf.
+
+ * font/devpdf/util/Makefile.sub: Removed.
+
+ * Makefile.in (DEVDIRS, OTHERDIRS, EXTRADIRS): Handle devpdf
+ specially.
+
2011-07-29 Daiki Ueno <ueno@unixuser.org>
Fix cross building.
diff --git a/Makefile.in b/Makefile.in
index 09eb5738..6d229b19 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -589,7 +589,6 @@ PROGDIRS=\
$(XPROGDIRS)
DEVDIRS=\
font/devps \
- font/devpdf \
font/devdvi \
font/devhtml
ALLTTYDEVDIRS=\
@@ -615,6 +614,7 @@ OTHERDIRS=\
contrib/hdtbl \
contrib/pdfmark \
src/devices/gropdf \
+ font/devpdf \
contrib/gdiffmk
ALLDIRS=\
@@ -630,7 +630,6 @@ EXTRADIRS=\
font/devps/generate \
font/devdvi/generate \
font/devlj4/generate \
- font/devpdf/util \
doc
NOMAKEDIRS=\
m4 \
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index fceddcc8..7b09e0f0 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -15164,7 +15164,7 @@ Put the directory @file{@var{dir}/dev@var{name}} in front of the
search path for the font, prologue and device description files,
given the target device @var{name}, usually @strong{pdf}.
-@item -fy@var{foundry}
+@item -y@var{foundry}
This forces the use of a different font foundry.
@item -l
diff --git a/font/devpdf/Makefile.sub b/font/devpdf/Makefile.sub
index e61c6503..a40a13b6 100644
--- a/font/devpdf/Makefile.sub
+++ b/font/devpdf/Makefile.sub
@@ -17,10 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
DEV=pdf
-GROFF_FONT_FILES=`cd $(DESTDIR)$(fontsubdir); \
- grep -l internalname * | grep -v Makefile.sub`
-ENC_FILES=`cd $(DESTDIR)$(fontsubdir); ls enc`
-MAP_FILES=`cd $(DESTDIR)$(fontsubdir); ls map`
+GROFF_FONT_FILES=`cd $(top_builddir)/font/devpdf \
+ && find * -maxdepth 0 -type f ! -name Makefile.sub \
+ -exec grep -l internalname {} \;`
+ENC_FILES=`cd $(top_builddir)/font/devpdf; ls enc/*`
+MAP_FILES=`cd $(top_builddir)/font/devpdf; ls map/*`
UTILFILES=\
BuildFoundries
@@ -28,14 +29,17 @@ UTILFILES=\
MOSTLYCLEANADD=\
download \
DESC \
+ Foundry \
util/BuildFoundries \
$(GROFF_FONT_FILES) \
$(ENC_FILES) \
$(MAP_FILES)
-#MOSTLYCLEANDIRADD=enc map
+
+MOSTLYCLEANDIRADD=enc map
DEVFILES=\
Foundry
+
#DEVSCRIPTS=util/BuildFoundries
DISTFILES=\
@@ -51,21 +55,53 @@ all: DESC BuildFoundries
DESC: DESC.in
-rm -f DESC
- cat $(srcdir)/DESC.in >DESC
+ cat $(srcdir)/DESC.in >$(top_builddir)/font/devpdf/DESC
if test "$(PAGE)" = A4; then \
- echo "papersize a4" >>DESC; \
+ echo "papersize a4" >>$(top_builddir)/font/devpdf/DESC; \
else \
- echo "papersize letter" >>DESC; \
+ echo "papersize letter" >>$(top_builddir)/font/devpdf/DESC; \
fi
+ -rm -f Foundry
+ cat $(srcdir)/Foundry.in >$(top_builddir)/font/devpdf/Foundry
BuildFoundries: util/BuildFoundries.pl $(SH_DEPS_SED_SCRIPT)
+ -test -d $(top_builddir)/font/devpdf/enc \
+ || $(mkinstalldirs) $(top_builddir)/font/devpdf/enc
+ -test -d $(top_builddir)/font/devpdf/map \
+ || $(mkinstalldirs) $(top_builddir)/font/devpdf/map
+ cp -f $(top_srcdir)/font/devps/text.enc \
+ $(top_builddir)/font/devpdf/enc
+ cp -f $(top_srcdir)/font/devps/symbolmap \
+ $(top_builddir)/font/devpdf/map
+ cp -f $(top_srcdir)/font/devps/generate/dingbats.map \
+ $(top_builddir)/font/devpdf/map
+ cp -f $(top_srcdir)/font/devps/generate/textmap \
+ $(top_builddir)/font/devpdf/map
+ cp -f $(top_srcdir)/font/devps/generate/symbolchars \
+ $(top_builddir)/font/devpdf/map
-test -d util || $(mkinstalldirs) util
$(RM) util/$@
+ if test -n "$(PERLPATH)"; then \
+ sed -f $(SH_DEPS_SED_SCRIPT) \
+ -e "s|/usr/bin/perl|$(PERLPATH)|" \
+ -e "s|@GROFF_GHOSTSCRIPT_INTERPRETERS@|$(GHOSTSCRIPT)|" \
+ -e "s|@VERSION@|$(version)$(revision)|" \
+ -e "s|@GROFF_FONT_DIR@|$(fontdir)|" \
+ $(srcdir)/util/BuildFoundries.pl \
+ >$(top_builddir)/font/devpdf/util/$@ ;\
+ else \
sed -f $(SH_DEPS_SED_SCRIPT) \
-e "s|@VERSION@|$(version)$(revision)|" \
- -e "s|@PERLPATH@|$(PERLPATH)|" \
- -e "s|@GROFF_FONT_DIR@|$(fontdir)|" $(srcdir)/util/BuildFoundries.pl > util/$@
+ -e "s|@GROFF_FONT_DIR@|$(fontdir)|" \
+ $(srcdir)/util/BuildFoundries.pl \
+ >$(top_builddir)/font/devpdf/util/$@ ;\
+ fi
chmod +x util/$@
+ echo "# foundry ps name psfile" > $(top_builddir)/font/devpdf/download
+ PATH="$(top_builddir)/src/utils/afmtodit:${GROFF_PATH_SEPARATOR}${PATH}" \
+ util/BuildFoundries $(top_builddir)/font/devpdf \
+ '$(top_srcdir)/font/devps : $(top_builddir)/font/devps' \
+ >> $(top_builddir)/font/devpdf/download
install_data:
-test -d $(DESTDIR)$(fontsubdir) \
@@ -83,25 +119,16 @@ install_data:
fi; \
done
$(RM) $@
- cp -f $(DESTDIR)$(fontdir)/devps/text.enc \
- $(DESTDIR)$(fontsubdir)/enc
- cp -f $(srcdir)/../devps/symbolmap \
- $(DESTDIR)$(fontsubdir)/map
- cp -f $(DESTDIR)$(fontdir)/devps/generate/dingbats.map \
- $(DESTDIR)$(fontsubdir)/map
- cp -f $(DESTDIR)$(fontdir)/devps/generate/textmap \
- $(DESTDIR)$(fontsubdir)/map
- cp -f $(DESTDIR)$(fontdir)/devps/generate/symbolchars \
- $(DESTDIR)$(fontsubdir)/map
- echo "# foundry ps name psfile" > $(DESTDIR)$(fontsubdir)/download
- util/BuildFoundries $(DESTDIR)$(fontsubdir) \
- > $(DESTDIR)$(fontsubdir)/download
uninstall_sub:
for f in $(MOSTLYCLEANADD); do \
$(RM) $(DESTDIR)$(fontsubdir)/$$f; \
done
- rmdir $(DESTDIR)$(fontsubdir)/enc
- rmdir $(DESTDIR)$(fontsubdir)/map
- rmdir $(DESTDIR)$(fontsubdir)/util
- rmdir $(DESTDIR)$(fontsubdir)
+ -test -d $(DESTDIR)$(fontsubdir)/enc \
+ && rmdir $(DESTDIR)$(fontsubdir)/enc
+ -test -d $(DESTDIR)$(fontsubdir)/map \
+ && rmdir $(DESTDIR)$(fontsubdir)/map
+ -test -d $(DESTDIR)$(fontsubdir)/util \
+ && rmdir $(DESTDIR)$(fontsubdir)/util
+ -test -d $(DESTDIR)$(fontsubdir) \
+ && rmdir $(DESTDIR)$(fontsubdir)
diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl
index 80756147..8f52fd1d 100644
--- a/font/devpdf/util/BuildFoundries.pl
+++ b/font/devpdf/util/BuildFoundries.pl
@@ -1,7 +1,7 @@
-#!@PERLPATH@ -w
+#!/usr/bin/perl -w
#
-# BuildFoundries: Given a Foundry file generate groff and download files
-# Deri James: Monday 07 Feb 2011
+# BuildFoundries : Given a Foundry file generate groff and download files
+# Deri James : Monday 07 Feb 2011
# Copyright (C) 2011 Free Software Foundation, Inc.
# Written by Deri James <deri@chuzzlewit.demon.co.uk>
@@ -24,6 +24,7 @@
use strict;
my $where=shift||'';
+my $devps=shift||'../devps';
chdir $where if $where ne '';
my (%foundry,%flg,@downloadpreamble,%download);
my $GSpath=FindGSpath();
@@ -38,6 +39,7 @@ WriteDownload("download");
exit $warn;
+
sub LoadFoundry
{
my $fn=shift;
@@ -67,7 +69,8 @@ sub LoadFoundry
if (lc($r[0]) eq 'foundry')
{
$foundry=uc($r[1]);
- $foundrypath=$r[2];
+ $foundrypath=$r[2].' : '.$devps;
+ $foundrypath=~s/\(gs\)/$GSpath /;
}
else
{
@@ -92,10 +95,11 @@ sub LoadFoundry
# Don't run afmtodit, just copy the grops font file
my $gotf=1;
+ my $gropsfnt=LocateFile($devps,$r[0],0);
- if (-r "../devps/$r[0]")
+ if ($gropsfnt ne '' and -r "$gropsfnt")
{
- my $psfont=UseGropsVersion($r[0]);
+ my $psfont=UseGropsVersion($gropsfnt);
if (!PutDownload($psfont,LocatePF($foundrypath,$r[5]),uc($r[1])))
{
if (uc($r[1]) ne 'Y')
@@ -106,6 +110,7 @@ sub LoadFoundry
}
}
print STDERR "Copied grops font $gfont...\n" if $gotf;
+
}
else
{
@@ -211,9 +216,11 @@ sub LocatePF
sub LocateFile
{
my $path=shift;
- my $file=shift;
+ my $files=shift;
my $tryafm=shift;
+ foreach my $file (split('!',$files))
+ {
if ($file=~m'/')
{
# path given with file name so no need to search the paths
@@ -234,11 +241,7 @@ sub LocateFile
return('');
}
- if ($path eq '(gs)')
- {
- $path=$GSpath;
- }
- elsif ($path eq '(tex)')
+ if ($path eq '(tex)')
{
my $res=`kpsewhich $file`;
return '' if $?;
@@ -246,10 +249,11 @@ sub LocateFile
return($res);
}
- my (@paths)=split(':',$path);
+ my (@paths)=split(/ (:|;)/,$path);
foreach my $p (@paths)
{
+ next if !defined($p) or $p eq ';' or $p eq ':';
$p=~s/^\s+//;
$p=~s/\s+$//;
@@ -268,13 +272,14 @@ sub LocateFile
}
}
}
+ }
return('');
}
sub FindGSpath
{
- my (@res)=`gs -h 2>/dev/null`;
+ my (@res)=`@GROFF_GHOSTSCRIPT_INTERPRETERS@ -h 2>/dev/null`;
return '' if $?;
my $buildpath='';
my $stg=1;
@@ -308,8 +313,10 @@ sub UseGropsVersion
{
my $gfont=shift;
my $psfont='';
+ my (@gfa)=split('/',$gfont);
+ my $gfontbase=pop(@gfa);
- if (open(GF,"<../devps/$gfont"))
+ if (open(GF,"<$gfont"))
{
my (@gf)=(<GF>);
my @ps=grep(/^internalname /,@gf);
@@ -327,7 +334,7 @@ sub UseGropsVersion
if ($psfont)
{
- if (open(GF,">$gfont"))
+ if (open(GF,">$gfontbase"))
{
local $"='';
print GF "@gf";
diff --git a/src/devices/gropdf/gropdf.man b/src/devices/gropdf/gropdf.man
index bdfe5727..a26a314b 100644
--- a/src/devices/gropdf/gropdf.man
+++ b/src/devices/gropdf/gropdf.man
@@ -25,11 +25,6 @@ the original English.
. ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
. el .TP "\\$1"
..
-.de TQ
-. br
-. ns
-. TP \$1
-..
.
.de FT
. if '\\*(.T'ps' .ft \\$1
@@ -53,7 +48,7 @@ gropdf \- PDF driver for groff
\#.OP \-I dir
.OP \-p papersize
\#.OP \-w n
-.OP \-fy foundry
+.OP \-y foundry
.RI [ files
.IR .\|.\|. ]
.YS
@@ -84,7 +79,7 @@ reads the standard input.
A filename of
.B \-
also causes
-.B grops
+.B gropdf
to read the standard input.
.
PDF output is written to the standard output.
@@ -188,7 +183,7 @@ for details.
Print the version number.
.
.TP
-.BI \-fy foundry
+.BI \-y foundry
Set the foundry to use for selecting fonts of the same name.
.
.TP
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 7c070569..e56aa262 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -91,6 +91,8 @@ my $thislev=1;
my $mark=undef;
my $suspendmark=undef;
my $n_flg=1;
+my $pginsert=-1; # Growth point for kids array
+my %pgnames; # 'names' of pages for switchtopage
my %ppsz=( 'ledger'=>[1224,792],
'legal'=>[612,1008],
@@ -131,9 +133,13 @@ my $version=0;
#Load_Config();
-GetOptions("F=s" => \$fd, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'e' => \$embedall, 'fy=s' => \$Foundry);
+GetOptions("F=s" => \$fd, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'e' => \$embedall, 'y=s' => \$Foundry);
-print "GNU gropdf (groff) version $cfg{GROFF_VERSION}\n", exit if $version;
+if ($version)
+{
+ print "GNU gropdf (groff) version $cfg{GROFF_VERSION}\n";
+ exit;
+}
# Search for 'font directory': paths in -f opt, shell var GROFF_FONT_PATH, default paths
@@ -191,6 +197,7 @@ my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
while (<>)
{
chomp;
+ s/\r$//;
$lct++;
do # The ahead buffer behaves like 'ungetc'
@@ -470,7 +477,7 @@ sub OpenFile
my $dirs=shift;
my $fnm=shift;
- if (substr($fnm,0,1) eq '/')
+ if (substr($fnm,0,1) eq '/' or substr($fnm,1,1) eq ':') # dos
{
return if -r "$fnm" and open($$f,"<$fnm");
}
@@ -557,7 +564,7 @@ sub do_x
$cat=$obj[$objct]->{DATA};
$objct++;
$pages=$obj[2]->{DATA};
- Put("%PDF-1.4\n%âãÏÓ\n");
+ Put("%PDF-1.4\n\x25\xe2\xe3\xcf\xd3\n");
}
elsif ($xcmd eq 'X')
{
@@ -866,6 +873,85 @@ sub do_x
$mark=$suspendmark;
$suspendmark=undef;
}
+ elsif (lc($xprm[1]) eq 'pagename')
+ {
+ if ($pginsert > -1)
+ {
+ $pgnames{$xprm[2]}=$pages->{Kids}->[$pginsert];
+ }
+ else
+ {
+ $pgnames{$xprm[2]}='top';
+ }
+ }
+ elsif (lc($xprm[1]) eq 'switchtopage')
+ {
+ my $ba=$xprm[2];
+ my $want=$xprm[3];
+
+ if ($pginsert > -1)
+ {
+ if (!defined($want) or $want eq '')
+ {
+ # no before/after
+ $want=$ba;
+ $ba='before';
+ }
+
+ if (!defined($ba) or $ba eq '' or $ba eq 'bottom')
+ {
+ $pginsert=$#{$pages->{Kids}};
+ }
+ elsif ($ba eq 'top')
+ {
+ $pginsert=-1;
+ }
+ else
+ {
+ if (exists($pgnames{$want}))
+ {
+ my $ref=$pgnames{$want};
+
+ if ($ref eq 'top')
+ {
+ $pginsert=-1;
+ }
+ else
+ {
+
+ foreach my $j (0..$#{$pages->{Kids}})
+ {
+ if ($ref eq $pages->{Kids}->[$j])
+ {
+ if ($ba eq 'before')
+ {
+ $pginsert=$j-1;
+ return;
+ }
+ elsif ($ba eq 'after')
+ {
+ $pginsert=$j;
+ return;
+ }
+ else
+ {
+ Msg(0,"Parameter must be top|bottom|before|after not '$ba'");
+ return;
+ }
+ }
+ }
+
+ Msg(0,"Can't find page ref '$ref'");
+ }
+ }
+ else
+ {
+ Msg(0,"Can't find page named '$want'");
+ }
+ }
+
+ }
+ }
}
elsif (lc(substr($xprm[0],0,9)) eq 'papersize')
{
@@ -2056,7 +2142,7 @@ sub do_p
$cpageno=++$objct;
- push(@{$pages->{Kids}},BuildObj($objct,
+ my $thispg=BuildObj($objct,
{'Type' => '/Page',
'Group' => {'CS' => '/DeviceRGB', 'S' => '/Transparency'},
'Parent' => '2 0 R',
@@ -2064,8 +2150,10 @@ sub do_p
{'Length' => 0}
) ],
}
- )
);
+
+ splice(@{$pages->{Kids}},++$pginsert,0,$thispg);
+
$objct+=1;
$cpage=$obj[$cpageno]->{DATA};
$pages->{'Count'}++;
@@ -2693,6 +2781,7 @@ sub LoadAhead
{
my $lin=<>;
chomp($lin);
+ $lin=~s/\r$//;
$lct++;
push(@ahead,$lin);