diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/postscript/buildtables |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/postscript/buildtables')
-rwxr-xr-x | sys/src/cmd/postscript/buildtables/README | 5 | ||||
-rwxr-xr-x | sys/src/cmd/postscript/buildtables/buildtables.1 | 214 | ||||
-rwxr-xr-x | sys/src/cmd/postscript/buildtables/buildtables.mk | 64 | ||||
-rwxr-xr-x | sys/src/cmd/postscript/buildtables/buildtables.sh | 94 |
4 files changed, 377 insertions, 0 deletions
diff --git a/sys/src/cmd/postscript/buildtables/README b/sys/src/cmd/postscript/buildtables/README new file mode 100755 index 000000000..caf5f3f1e --- /dev/null +++ b/sys/src/cmd/postscript/buildtables/README @@ -0,0 +1,5 @@ +Programs for building troff width tables on a PostScript printer. +Assumes you have direct access to the printer's serial port. Also +needs a special table dependent shell library file to build the +tables (e.g. ../devLatin1/shell.lib). + diff --git a/sys/src/cmd/postscript/buildtables/buildtables.1 b/sys/src/cmd/postscript/buildtables/buildtables.1 new file mode 100755 index 000000000..dd7ce7de9 --- /dev/null +++ b/sys/src/cmd/postscript/buildtables/buildtables.1 @@ -0,0 +1,214 @@ +.ds dF /usr/lib/font +.ds dQ /usr/lib/postscript +.TH BUILDTABLES 1 "DWB 3.2" +.SH NAME +.B buildtables +\- build +.B troff +tables on a PostScript printer +.SH SYNOPSIS +\*(mBbuildtables\f1 +.OP "" options [] +.OP "" "name \(el" [] +.SH DESCRIPTION +.B buildtables +builds font width tables or the typesetter description +file on a PostScript printer. +No arguments means build a default set of tables; +usually a superset of the LaserWriter Plus collection. +The following +.I options +are understood: +.TP 1.0i +.OP \-b speed +Transmit data over +.I line +at baud rate +.I speed. +Recognized baud rates are 1200, 2400, 4800, 9600, and 19200. +The default +.I speed +is 9600 baud. +.TP 1.0i +.OP \-l line +Build the tables on the PostScript printer attached to +.I line. +There is no default. +.TP 1.0i +.OP \-t name +Use +.I name +as the template for fonts not in the default set. +Choose +.MW R +for proportionally spaced fonts and +.MW CW +for fixed width fonts. +Try +.MW ZD +(ZapfDingbats) if the font has a non-standard +character set. +The default is +.MR R . +.TP 1.0i +.OP \-C file +Copy +.I file +into each PostScript table program; +.I file +must contain legitimate PostScript. +.TP 1.0i +.OP \-H hostdir +Use +.I hostdir +as the host-resident font directory. +A file in +.I hostdir +that matches the name of the +.B troff +font is assumed to be a host-resident font program and is included +in the PostScript width table program. +There is no default. +.TP 1.0i +.OP \-S file +Use +.I file +as the shell library file. +Overrides the choice made with the +.OP \-T +option. +.TP 1.0i +.OP \-T name +Set the target device to +.I name. +.br +Device +.I name +means +.ft 2 +.MI \*(dF/dev name /shell.lib +.ft 1 +is the shell library file. +There is no default. +.PP +If +.OP \-l +is omitted output files are the PostScript programs that +build the tables, rather than the tables themselves. +One of +.OP \-T +or +.OP \-S +is required. +If both are given +.OP \-S +wins. +Although +.OP \-H +is the preferred mechanism for including host-resident font files, +.OP \-C +makes sense when only one width table is built. +.PP +The shell library file defines a collection of functions used to +build +.BR troff (1) +tables. +The default set of tables is the list of names returned by the +.MW AllTables +function. +Changes to the default list can be made by updating the +.MW BuiltinTables +function. +.PP +Each +.B buildtables +argument +must be a default table name, or a pair of names enclosed in quotes. +If the argument is a pair, the first name is the +.B troff +font and the second is the full PostScript font name. +Tables are created in the current directory. +Each is assigned a name that matches the +.B troff +table name. +.PP +The PostScript table programs created by +.BR trofftable (1) +are written to files that have +.MW .ps +appended to the +.B troff +table name. +The +.MW .ps +file is deleted after the table is built. +Options not listed above are passed to +.B trofftable. +The PostScript table programs return data to the host computer using +PostScript's +.MW print +operator. +See +.BR hardcopy (1) +if you do not have access to the printer's serial port. +.SH EXAMPLES +.PP +Build the default collection of devpost tables on the printer +connected to +.MW /dev/tty00 +(no font name arguments): +.EX +buildtables -l/dev/tty00 -Tpost +.EE +To do the same and to restrict the tables that are built, +Add +.B troff +font names (or +.MR DESC ) +to restrict the tables built on the printer connected to +.MR /dev/tty00 : +.EX +buildtables -l/dev/tty00 -Tpost R I B BI DESC S +.EE +Enclose the +.B troff +and PostScript font names in quotes to +build the width table for a font not in the default set +(also on the printer connected to +.MR /dev/tty00 ): +.EX +buildtables -l/dev/tty00 -TLatin1 "GL Garamond-Light" +.EE +A font must be available on the printer when the table is built. +Use +.OP \-H +or +.OP \-C +to include host-resident fonts. +.SH WARNINGS +.PP +A width table will not build properly if the printer cannot access +the PostScript font. +.PP +The +.OP \-TLatin1 +option only works on PostScript printers that support the full +.SM ISO +Latin-1 character set. +The error message from older printers will likely indicate a missing +.MW ISOLatin1Encoding +array. +.SH FILES +.MW \*(dF/dev*/shell.lib +.br +.MW \*(dQ/dpost.ps +.br +.MW \*(dQ/trofftable.ps +.br +.SH SEE ALSO +.BR dpost (1), +.BR hardcopy (1), +.BR postio (1), +.BR troff (1), +.BR trofftable (1), +.BR font (5) diff --git a/sys/src/cmd/postscript/buildtables/buildtables.mk b/sys/src/cmd/postscript/buildtables/buildtables.mk new file mode 100755 index 000000000..73c77473b --- /dev/null +++ b/sys/src/cmd/postscript/buildtables/buildtables.mk @@ -0,0 +1,64 @@ +MAKE=/bin/make +MAKEFILE=buildtables.mk + +SYSTEM=V9 +VERSION=3.3.2 + +GROUP=bin +OWNER=bin + +FONTDIR=/usr/lib/font +POSTBIN=/usr/bin/postscript +POSTLIB=/usr/lib/postscript +MAN1DIR=/tmp + +all : buildtables + +install : all + @if [ ! -d $(POSTBIN) ]; then \ + mkdir $(POSTBIN); \ + chmod 755 $(POSTBIN); \ + chgrp $(GROUP) $(POSTBIN); \ + chown $(OWNER) $(POSTBIN); \ + fi + cp buildtables $(POSTBIN)/buildtables + @chmod 755 $(POSTBIN)/buildtables + @chgrp $(GROUP) $(POSTBIN)/buildtables + @chown $(OWNER) $(POSTBIN)/buildtables + cp buildtables.1 $(MAN1DIR)/buildtables.1 + @chmod 644 $(MAN1DIR)/buildtables.1 + @chgrp $(GROUP) $(MAN1DIR)/buildtables.1 + @chown $(OWNER) $(MAN1DIR)/buildtables.1 + +clean : + +clobber : clean + rm -f buildtables + +buildtables : buildtables.sh + sed \ + -e "s'^FONTDIR=.*'FONTDIR=$(FONTDIR)'" \ + -e "s'^POSTBIN=.*'POSTBIN=$(POSTBIN)'" \ + -e "s'^POSTLIB=.*'POSTLIB=$(POSTLIB)'" \ + buildtables.sh >buildtables + @chmod 755 buildtables + +changes : + @trap "" 1 2 3 15; \ + sed \ + -e "s'^SYSTEM=.*'SYSTEM=$(SYSTEM)'" \ + -e "s'^VERSION=.*'VERSION=$(VERSION)'" \ + -e "s'^GROUP=.*'GROUP=$(GROUP)'" \ + -e "s'^OWNER=.*'OWNER=$(OWNER)'" \ + -e "s'^FONTDIR=.*'FONTDIR=$(FONTDIR)'" \ + -e "s'^POSTBIN=.*'POSTBIN=$(POSTBIN)'" \ + -e "s'^POSTLIB=.*'POSTLIB=$(POSTLIB)'" \ + -e "s'^MAN1DIR=.*'MAN1DIR=$(MAN1DIR)'" \ + $(MAKEFILE) >XXX.mk; \ + mv XXX.mk $(MAKEFILE); \ + sed \ + -e "s'^.ds dF.*'.ds dF $(FONTDIR)'" \ + -e "s'^.ds dQ.*'.ds dQ $(POSTLIB)'" \ + buildtables.1 >XXX.1; \ + mv XXX.1 buildtables.1 + diff --git a/sys/src/cmd/postscript/buildtables/buildtables.sh b/sys/src/cmd/postscript/buildtables/buildtables.sh new file mode 100755 index 000000000..f9e4404d7 --- /dev/null +++ b/sys/src/cmd/postscript/buildtables/buildtables.sh @@ -0,0 +1,94 @@ +# +# Builds one or more font width tables or the typesetter description +# file on a PostScript printer. Assumes you have direct access to the +# printer's serial port. No arguments means build a standard collection +# of tables - usually the LaserWriter Plus set. See trofftable and the +# shell library files /usr/lib/font/dev*/shell.lib for more details. +# + +set -e + +POSTBIN=/usr/lbin/postscript +POSTLIB=/usr/lib/postscript +FONTDIR=/usr/lib/font + +POSTIO=$POSTBIN/postio +TROFFTABLE=$POSTBIN/trofftable + +BAUDRATE= +DEVICE= +LIBRARY= + +while [ -n "$1" ]; do + case $1 in + -C) shift; OPTIONS="$OPTIONS -C$1";; + -C*) OPTIONS="$OPTIONS $1";; + + -F) shift; FONTDIR=$1;; + -F*) FONTDIR=`echo $1 | sed s/-F//`;; + + -H) shift; OPTIONS="$OPTIONS -H$1";; + -H*) OPTIONS="$OPTIONS $1";; + + -S) shift; LIBRARY=$1;; + -S*) LIBRARY=`echo $1 | sed s/-S//`;; + + -T) shift; DEVICE=$1;; + -T*) DEVICE=`echo $1 | sed s/-T//`;; + + -b) shift; BAUDRATE=$1;; + -b*) BAUDRATE=`echo $1 | sed s/-b//`;; + + -c) shift; OPTIONS="$OPTIONS -c$1";; + -c*) OPTIONS="$OPTIONS $1";; + + -l) shift; LINE=$1;; + -l*) LINE=`echo $1 | sed s/-l//`;; + + -s) shift; OPTIONS="$OPTIONS -s$1";; + -s*) OPTIONS="$OPTIONS $1";; + + -t) shift; OPTIONS="$OPTIONS -t$1";; + -t*) OPTIONS="$OPTIONS $1";; + + -?) OPTIONS="$OPTIONS $1$2"; shift;; + -?*) OPTIONS="$OPTIONS $1";; + + *) break;; + esac + shift +done + +if [ ! "$DEVICE" -a ! "$LIBRARY" ]; then + echo "$0: no device or shell library" >&2 + exit 1 +fi + +LIBRARY=${LIBRARY:-${FONTDIR}/dev${DEVICE}/shell.lib} + +# +# No arguments means build everything return by the AllTables function. +# + +if [ $# -eq 0 ]; then + . $LIBRARY + set -- `AllTables` +fi + +for i do + SHORT=`echo $i | awk '{print $1}'` + LONG=`echo $i | awk '{print $2}'` + + if [ "$LINE" ] + then echo "==== Building table $SHORT ====" + else echo "==== Creating table program $SHORT.ps ====" + fi + + $TROFFTABLE -S$LIBRARY $OPTIONS $SHORT $LONG >$SHORT.ps + + if [ "$LINE" ]; then + $POSTIO -t -l$LINE ${BAUDRATE:+-b${BAUDRATE}} $SHORT.ps >$SHORT + rm -f $SHORT.ps + fi +done + |