diff options
author | wl <wl> | 2011-07-26 17:11:09 +0000 |
---|---|---|
committer | wl <wl> | 2011-07-26 17:11:09 +0000 |
commit | 10f2f7c92c0a878763d523dd798c6c4be0f8e3aa (patch) | |
tree | 86ac4914be0670f0dce3fdba56264c585b75e1e9 /font/devpdf | |
parent | 8f6aeb4493fb6f1a38e83f2050d27529fc2d238b (diff) | |
download | groff-10f2f7c92c0a878763d523dd798c6c4be0f8e3aa.tar.gz |
Add new output device `gropdf'.
* font/devpdf/*: New device files for gropdf.
* src/devices/gropdf/*: New device.
* Makefile.comm (install_dev, uninstall_dev): Handle more
subdirectories.
* Makefile.in (DEVDIRS, OTHERDIRS, EXTRADIRS): Add directories
related to gropdf.
* MANIFEST: Updated.
* test-groff.in (GROFF_BIN_PATH): Updated.
* tmac/Makefile.sub (NORMALFILES): Updated.
* tmac/pdf.tmac: New file.
* tmac/troffrc: Updated.
* doc/groff.texinfo: Document it.
* doc/Makefile.in, doc/Makefile.sub (groff_bin_dirs): Udpated.
* doc/pic.ms: Updated.
* man/groff_out.man, src/devices/grops/grops.man,
src/preproc/pic/pic.man, src/roff/groff/groff.man,
src/utils/afmtodit/afmtodit.man, src/utils/pfbtops/pfbtops.man:
Updated.
* contrib/pdfmark/pdfmark.ms: Updated.
Diffstat (limited to 'font/devpdf')
-rw-r--r-- | font/devpdf/DESC.in | 11 | ||||
-rw-r--r-- | font/devpdf/Foundry | 114 | ||||
-rw-r--r-- | font/devpdf/Makefile.sub | 107 | ||||
-rw-r--r-- | font/devpdf/util/BuildFoundries.pl | 439 | ||||
-rw-r--r-- | font/devpdf/util/Makefile.sub | 38 |
5 files changed, 709 insertions, 0 deletions
diff --git a/font/devpdf/DESC.in b/font/devpdf/DESC.in new file mode 100644 index 00000000..5cb254f3 --- /dev/null +++ b/font/devpdf/DESC.in @@ -0,0 +1,11 @@ +res 72000 +hor 1 +vert 1 +sizescale 1000 +unitwidth 1000 +sizes 1000-10000000 0 +styles R I B BI +family T +fonts 8 0 0 0 0 0 0 S ZD +tcommand +postpro gropdf diff --git a/font/devpdf/Foundry b/font/devpdf/Foundry new file mode 100644 index 00000000..52d728cf --- /dev/null +++ b/font/devpdf/Foundry @@ -0,0 +1,114 @@ +# Foundry file + +# Copyright (C) 2011 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/>. + +#===================================================================== +#Foundry|Name|Searchpath +foundry||(gs) + +# These are just copies of the grops fonts so MUST not have any flags etc set + +#Font|IsBase14|Flags|Map|Encoding|File +AB|N||||URWGothicL-Demi +ABI|N||||URWGothicL-DemiObli +AI|N||||URWGothicL-BookObli +AR|N||||URWGothicL-Book +BMB|N||||URWBookmanL-DemiBold +BMBI|N||||URWBookmanL-DemiBoldItal +BMI|N||||URWBookmanL-LighItal +BMR|N||||URWBookmanL-Ligh +CB|Y||||NimbusMonL-Bold +CBI|Y||||NimbusMonL-BoldObli +CI|Y||||NimbusMonL-ReguObli +CR|Y||||NimbusMonL-Regu +EURO|N||||../devps/freeeuro.pfa +HB|Y||||NimbusSanL-Bold +HBI|Y||||NimbusSanL-BoldItal +HI|Y||||NimbusSanL-ReguItal +HNB|N||||NimbusSanL-BoldCond +HNBI|N||||NimbusSanL-BoldCondItal +HNI|N||||NimbusSanL-ReguCondItal +HNR|N||||NimbusSanL-ReguCond +HR|Y||||NimbusSanL-Regu +NB|N||||CenturySchL-Bold +NBI|N||||CenturySchL-BoldItal +NI|N||||CenturySchL-Ital +NR|N||||CenturySchL-Roma +PB|N||||URWPalladioL-Bold +PBI|N||||URWPalladioL-BoldItal +PI|N||||URWPalladioL-Ital +PR|N||||URWPalladioL-Roma +S|Y||||StandardSymL +TB|Y||||NimbusRomNo9L-Medi +TBI|Y||||NimbusRomNo9L-MediItal +TI|Y||||NimbusRomNo9L-ReguItal +TR|Y||||NimbusRomNo9L-Regu +ZCMI|N||||URWChanceryL-MediItal +ZD|Y||||Dingbats + +#====================================================================== + +#Foundry|Name|Searchpath +foundry|U|(gs) # the URW fonts delivered with ghostscript (may be different) + +#Define Flags for afmtodit + +r=-i 0 -m +i=-i 50 +n=-n +s=-s + +#Font|IsBase14|Flags|Map|Encoding|File +AB|N|r|textmap|text.enc|a010015l.pfb +ABI|N|i|textmap|text.enc|a010035l.pfb +AI|N|i|textmap|text.enc|a010033l.pfb +AR|N|r|textmap|text.enc|a010013l.pfb +BMB|N|r|textmap|text.enc|b018015l.pfb +BMBI|N|i|textmap|text.enc|b018035l.pfb +BMI|N|i|textmap|text.enc|b018032l.pfb +BMR|N|r|textmap|text.enc|b018012l.pfb +CB|N|nr|textmap|text.enc|n022004l.pfb +CBI|N|ni|textmap|text.enc|n022024l.pfb +CI|N|ni|textmap|text.enc|n022023l.pfb +CR|N|nr|textmap|text.enc|n022003l.pfb +HB|N|r|textmap|text.enc|n019004l.pfb +HBI|N|i|textmap|text.enc|n019024l.pfb +HI|N|i|textmap|text.enc|n019023l.pfb +HNB|N|r|textmap|text.enc|n019044l.pfb +HNBI|N|i|textmap|text.enc|n019064l.pfb +HNI|N|i|textmap|text.enc|n019063l.pfb +HNR|N|r|textmap|text.enc|n019043l.pfb +HR|N|r|textmap|text.enc|n019003l.pfb +NB|N|r|textmap|text.enc|c059016l.pfb +NBI|N|i|textmap|text.enc|c059036l.pfb +NI|N|i|textmap|text.enc|c059033l.pfb +NR|N|r|textmap|text.enc|c059013l.pfb +PB|N|r|textmap|text.enc|p052004l.pfb +PBI|N|i|textmap|text.enc|p052024l.pfb +PI|N|i|textmap|text.enc|p052023l.pfb +PR|N|r|textmap|text.enc|p052003l.pfb +S|N|sr|symbolmap||s050000l.pfb +TB|N|r|textmap|text.enc|n021004l.pfb +TBI|N|i|textmap|text.enc|n021024l.pfb +TI|N|i|textmap|text.enc|n021023l.pfb +TR|N|r|textmap|text.enc|n021003l.pfb +ZCMI|N|i|textmap|text.enc|z003034l.pfb +ZD|N|sr|dingbats.map||d050000l.pfb + +#====================================================================== diff --git a/font/devpdf/Makefile.sub b/font/devpdf/Makefile.sub new file mode 100644 index 00000000..e61c6503 --- /dev/null +++ b/font/devpdf/Makefile.sub @@ -0,0 +1,107 @@ +# Copyright (C) 2011 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/>. + +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` + +UTILFILES=\ + BuildFoundries + +MOSTLYCLEANADD=\ + download \ + DESC \ + util/BuildFoundries \ + $(GROFF_FONT_FILES) \ + $(ENC_FILES) \ + $(MAP_FILES) +#MOSTLYCLEANDIRADD=enc map + +DEVFILES=\ + Foundry +#DEVSCRIPTS=util/BuildFoundries + +DISTFILES=\ + $(DEVFILES) \ + $(DEVSCRIPTS) + + +# Some `makes' don't predefine RM... +RM=rm -f + + +all: DESC BuildFoundries + +DESC: DESC.in + -rm -f DESC + cat $(srcdir)/DESC.in >DESC + if test "$(PAGE)" = A4; then \ + echo "papersize a4" >>DESC; \ + else \ + echo "papersize letter" >>DESC; \ + fi + +BuildFoundries: util/BuildFoundries.pl $(SH_DEPS_SED_SCRIPT) + -test -d util || $(mkinstalldirs) util + $(RM) util/$@ + 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/$@ + chmod +x util/$@ + +install_data: + -test -d $(DESTDIR)$(fontsubdir) \ + || $(mkinstalldirs) $(DESTDIR)$(fontsubdir) + -test -d $(DESTDIR)$(fontsubdir)/enc \ + || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/enc + -test -d $(DESTDIR)$(fontsubdir)/map \ + || $(mkinstalldirs) $(DESTDIR)$(fontsubdir)/map + for f in $(MOSTLYCLEANADD); do \ + $(RM) $(DESTDIR)$(fontsubdir)/$$f; \ + if test -f $$f; then \ + $(INSTALL_DATA) $$f $(DESTDIR)$(fontsubdir)/$$f; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(fontsubdir)/$$f; \ + 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) diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl new file mode 100644 index 00000000..80756147 --- /dev/null +++ b/font/devpdf/util/BuildFoundries.pl @@ -0,0 +1,439 @@ +#!@PERLPATH@ -w +# +# 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> +# +# 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 $where=shift||''; +chdir $where if $where ne ''; +my (%foundry,%flg,@downloadpreamble,%download); +my $GSpath=FindGSpath(); +my $warn=0; +my $lct=0; +my $foundry=''; # the default foundry + +LoadDownload("download"); +LoadFoundry("Foundry"); +WriteDownload("download"); + +exit $warn; + + +sub LoadFoundry +{ + my $fn=shift; + my $foundrypath=''; + + open(F,"<$fn") or die "No $fn file found"; + + while (<F>) + { + chomp; + $lct++; + s/\r$//; # in case edited in windows + + s/\s*#.*?$//; # remove comments + + next if $_ eq ''; + + if (m/^[A-Za-z]=/) + { + my (@f)=split('='); + $flg{$f[0]}=$f[1]; + next; + } + + my (@r)=split('\|'); + + if (lc($r[0]) eq 'foundry') + { + $foundry=uc($r[1]); + $foundrypath=$r[2]; + } + else + { + # 0=groff font name + # 1=IsBase Y/N (one of PDFs 14 base fonts) + # 2=afmtodit flag + # 3=map file + # 4=encoding file + # 5=font file + # 6=afm file + + if (!defined($r[6]) or $r[6] eq '') + { + # if no afm file, have a guess! + $r[6]=substr($r[5],0,-3)."afm"; + } + + my $gfont=($foundry eq '')?$r[0]:"$foundry-$r[0]"; + + if ($r[2] eq '') + { + # Don't run afmtodit, just copy the grops font file + + my $gotf=1; + + if (-r "../devps/$r[0]") + { + my $psfont=UseGropsVersion($r[0]); + if (!PutDownload($psfont,LocatePF($foundrypath,$r[5]),uc($r[1]))) + { + if (uc($r[1]) ne 'Y') + { + $gotf=0; + Msg(0,"Unable to locate font '$r[5]' on the given path(s)"); + unlink $gfont; # Unable to find the postscript file for the font just created by afmtodit + } + } + print STDERR "Copied grops font $gfont...\n" if $gotf; + } + else + { + Msg(0,"Can't read grops font '$r[0]' for Foundry '$foundry'"); + } + } + else + { + # We need to run afmtodit to create this groff font + my $psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[6]),$r[2],$r[3],$r[4]); + + if ($psfont) + { + if (!PutDownload($psfont,LocatePF($foundrypath,$r[5]),uc($r[1]))) + { + unlink $gfont; # Unable to find the postscript file for the font just created by afmtodit + } + else + { + print STDERR "Generated $gfont...\n"; + } + } + else + { + Msg(0,"Failed to create groff font '$gfont' by running afmtodit"); + } + } + } + } + + close(); +} + +sub RunAfmtodit +{ + my $gfont=shift; + my $afmfile=shift; + my $flags=shift; + my $map=shift||''; + my $enc=shift||''; + my $psfont=''; + + $enc="-e 'enc/$enc'" if $enc; + $map="'map/$map'" if $map; + + my $cmd='afmtodit -c -dDESC'; + + foreach my $f (split('',$flags)) + { + if (!exists($flg{$f})) + { + Msg(0,"Can't use undefined flag '$f' in calling afmtodit for groff font '$gfont'"); + return(''); + } + + $cmd.=" $flg{$f}"; + } + + system("$cmd $enc '$afmfile' $map $gfont 2>/dev/null"); + + if ($?) + { + unlink $gfont; + return(''); + } + + if (open(GF,"<$gfont")) + { + my (@gf)=(<GF>); + my @ps=grep(/^internalname /,@gf); + if ($#ps == 0) # Just 1 match + { + (undef,$psfont)=split(' ',$ps[0],2); + chomp($psfont); + } + else + { + Msg(0,"Unexpected format for grops font '$gfont' for Foundry '$foundry' - ignoring"); + } + + close(GF); + } + + return($psfont); +} + +sub LocateAF +{ + my $path=shift; + my $file=shift; + + return(LocateFile($path,$file,1)); +} + +sub LocatePF +{ + my $path=shift; + my $file=shift; + + return(LocateFile($path,$file,0)); +} + +sub LocateFile +{ + my $path=shift; + my $file=shift; + my $tryafm=shift; + + if ($file=~m'/') + { + # path given with file name so no need to search the paths + + if (-r $file) + { + return($file); + } + + if ($tryafm and $file=~s'type1/'afm/'i) + { + if (-r "$file") + { + return($file); + } + } + + return(''); + } + + if ($path eq '(gs)') + { + $path=$GSpath; + } + elsif ($path eq '(tex)') + { + my $res=`kpsewhich $file`; + return '' if $?; + chomp($res); + return($res); + } + + my (@paths)=split(':',$path); + + foreach my $p (@paths) + { + $p=~s/^\s+//; + $p=~s/\s+$//; + + next if $p=~m/^\%rom\%/; # exclude %rom% paths (from (gs)) + + if (-r "$p/$file") + { + return("$p/$file"); + } + + if ($tryafm and $p=~s'type1/'afm/'i) + { + if (-r "$p/$file") + { + return("$p/$file"); + } + } + } + + return(''); +} + +sub FindGSpath +{ + my (@res)=`gs -h 2>/dev/null`; + return '' if $?; + my $buildpath=''; + my $stg=1; + + foreach my $l (@res) + { + chomp($l); + + if ($stg==1 and $l=~m/^Search path:/) + { + $stg=2; + } + elsif ($stg == 2) + { + if (substr($l,0,1) ne ' ') + { + $stg=3; + } + else + { + $l=~s/^\s+//; + $buildpath.=$l; + } + } + } + + return($buildpath); +} + +sub UseGropsVersion +{ + my $gfont=shift; + my $psfont=''; + + if (open(GF,"<../devps/$gfont")) + { + my (@gf)=(<GF>); + my @ps=grep(/^internalname /,@gf); + if ($#ps == 0) # Just 1 match + { + (undef,$psfont)=split(' ',$ps[0],2); + chomp($psfont); + } + else + { + Msg(0,"Unexpected format for grops font '$gfont' for Foundry '$foundry' - ignoring"); + } + + close(GF); + + if ($psfont) + { + if (open(GF,">$gfont")) + { + local $"=''; + print GF "@gf"; + close(GF); + } + else + { + $psfont=''; + Msg(0,"Failed to create new font '$gfont' for Foundry '$foundry'"); + } + } + else + { + Msg(0,"Failed to locate postscript internalname in grops font '$gfont' for Foundry '$foundry'"); + } + + close(GF); + } + else + { + Msg(0,"Failed to open grops font '$gfont' for Foundry '$foundry'"); + } + + return($psfont); +} + +sub PutDownload +{ + my $psfont=shift; + my $pffile=shift; + my $IsBase14=shift; + my $key="$foundry $psfont"; + + delete($download{$key}), return 0 if ($pffile eq ''); + + $pffile='*'.$pffile if $IsBase14 eq 'Y'; # This signals to gropdf to only edmbed if -e given + $download{$key}=$pffile; + + return 1; +} + +sub LoadDownload +{ + my $fn=shift; + my $top=1; + + return if !open(F,"<$fn"); + + while (<F>) + { + chomp; + s/\r$//; # in case edited in windows + + if ($top and substr($_,0,1) eq '#' or $_ eq '') + { + # Preserve comments at top of download file + + push(@downloadpreamble,$_); + next; + } + + $top=0; + s/\s*#.*?$//; # remove comments + + next if $_ eq ''; + + my (@r)=split(/\t+/); + my $key=$r[1]; + $key="$r[0] $r[1]"; + $download{$key}=$r[2]; + } + + close(F); +} + +sub WriteDownload +{ + my $fn=shift; + my $top=1; + + open(F,">$fn") or die "Can't Create new file '$fn'"; + + print F join("\n",@downloadpreamble),"\n"; + + foreach my $k (sort keys %download) + { + my ($f,$ps)=split(/ /,$k); + print F "$f\t$ps\t$download{$k}\n"; + } + + close(F); +} + +sub Msg +{ + my $sev=shift; + my $msg=shift; + + if ($sev) + { + print STDERR "Error: line $lct: $msg\n"; + exit 2; + } + else + { + print STDERR "Warning: line $lct: $msg\n"; + $warn=1; + } +} diff --git a/font/devpdf/util/Makefile.sub b/font/devpdf/util/Makefile.sub new file mode 100644 index 00000000..360f9803 --- /dev/null +++ b/font/devpdf/util/Makefile.sub @@ -0,0 +1,38 @@ +# Copyright (C) 2011 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/>. + +DEV=pdf +UTILFILES=\ + BuildFoundries + +#MOSTLYCLEANADD=BuildFoundries + +# Some `makes' don't predefine RM... +RM=rm -f + + +all: BuildFoundries + + +BuildFoundries: BuildFoundries.pl $(SH_DEPS_SED_SCRIPT) + $(RM) $@ + sed -f $(SH_DEPS_SED_SCRIPT) \ + -e "s|@VERSION@|$(version)$(revision)|" \ + -e "s|@PERLPATH@|$(PERLPATH)|" \ + -e "s|@GROFF_FONT_DIR@|$(fontdir)|" $(srcdir)/BuildFoundries.pl >$@ + chmod +x $@ |