source: trunk/third/tex/xdvi/gsftopk/xdvimakepk @ 12209

Revision 12209, 4.7 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12208, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3#   This script file makes a new TeX PK font, because one wasn't found.
4#
5#   It must echo the name of the generated PK file (and nothing else) to
6#   standard output or to the designated file descriptor.
7#   Yes, this is different from the original dvips.
8#
9#   Parameters are:
10#
11#   name dpi bdpi magnification [mode [destdir [redirect]]]
12#
13#   `name'          is the name of the font, such as `cmr10'.
14#   `dpi'           is the resolution the font is needed at.
15#   `bdpi'          is the base resolution, useful for figuring out the mode to
16#                   make the font in.
17#   `magnification' is a string to pass to MF as the magnification.
18#   `mode'          (if supplied) is the mode to use.  If it's `default,'
19#                   then we guess.
20#   `destdir'       (if supplied) is the absolute directory name to use.
21#   `redirect'      (if supplied) is a string of the form '>&n', where n is the
22#                   number of the file descriptor which is to receive,
23#                   instead of stdout, the name of the newly created pk file.
24#
25#   Note that this file must execute Metafont, and then gftopk,
26#   and place the result in the correct location for the PostScript
27#   driver to find it subsequently.  If this doesn't work, it will
28#   be evident because this file will be invoked over and over again.
29#
30#   Of course, it needs to be set up for your site.
31#
32TEXDIR=/usr/lib/tex
33LOCALDIR=/LocalLibrary/Fonts/TeXFonts
34DESTDIR=$LOCALDIR/pk
35MAPFILE=/usr/local/tex/lib/dvips/psfonts.map
36#
37# TEMPDIR needs to be unique for each process because of the possibility
38# of simultaneous processes running this script.
39#
40if test "$TMPDIR" = ""
41then
42   TEMPDIR=/tmp/mtpk.$$
43else
44   TEMPDIR=$TMPDIR/mtpk.$$
45fi
46NAME=$1
47DPI=$2
48BDPI=$3
49MAG=$4
50MODE=$5
51#
52#   Prevent display under the X Window System.  Except it doesn't always work;
53#   some sh'ells don't seem to understand unset.  There are also some
54#   versions of METAFONT that don't work if the DISPLAY isn't set and
55#   the term type is set to xterm.
56#
57# unset DISPLAY
58umask 0
59
60if test "$MODE" = ""
61then
62   if test $BDPI = 300
63   then
64      MODE=imagen
65   elif test $BDPI = 200
66   then
67      MODE=FAX
68   elif test $BDPI = 360
69   then
70      MODE=nextII
71   elif test $BDPI = 400
72   then
73      MODE=nexthi
74   elif test $BDPI = 100
75   then
76      MODE=nextscreen
77   elif test $BDPI = 72
78   then
79      MODE=seventwo
80   elif test $BDPI = 635
81   then
82      MODE=linolo
83   elif test $BDPI = 1270
84   then
85      MODE=linohi
86   elif test $BDPI = 2540
87   then
88      MODE=linosuper
89   else
90      echo "I don't know the mode for $BDPI" >&2
91      echo "Have your system admin update MakeTeXPK" >&2
92      exit 1
93   fi
94fi
95
96#  Something like the following is useful at some sites.
97# DESTDIR=/usr/local/lib/tex/fonts/pk.$MODE
98GFNAME=$NAME.$DPI'gf'
99PKNAME=$NAME.$DPI'pk'
100
101if test "$6" != ""
102then
103   DESTDIR="$6"
104fi
105
106if test ! -d $DESTDIR
107then
108   mkdir $DESTDIR
109   chmod 777 $DESTDIR
110fi
111
112REDIRECT=
113if test -n "$7"; then
114  REDIRECT=`echo "$7" | sed 's/^>&//'`
115  if test `(cat /dev/null >&$REDIRECT) 2>&1 | wc -l` -ne 0; then
116    echo "$0: argument '$7' ignored - bad file number" >&2
117    REDIRECT=
118  fi
119fi
120
121
122# added by gwb, to allow searching in current dir before cd'ing
123if test "$MFINPUTS" != ""
124then
125   MFINPUTS=$MFINPUTS:`pwd`; export MFINPUTS
126fi
127
128
129# Beginning of main function definition.
130generate()
131{
132
133mkdir $TEMPDIR
134cd $TEMPDIR
135
136if test -r $DESTDIR/$PKNAME
137then
138   echo "$DESTDIR/$PKNAME already exists!"
139   showname $DESTDIR/$PKNAME
140   exit 0
141fi
142
143# check also in the standard place
144
145if test -r $TEXDIR/fonts/pk/$PKNAME
146then
147   echo $TEXDIR/fonts/pk/$PKNAME already exists!
148   showname $TEXDIR/fonts/pk/$PKNAME
149   exit 0
150fi
151
152if egrep \^$NAME'([     ]|$)' $MAPFILE > /dev/null
153  then
154
155    gsftopk $NAME $DPI || exit 1
156
157  else
158
159    unset DISPLAY
160    echo "mf \"\\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME\" </dev/null"
161    mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
162    if test ! -r $GFNAME
163    then
164       echo "Metafont failed for some reason on $GFNAME"
165       exit 1
166    fi
167
168    gftopk -v ./$GFNAME ./$PKNAME
169
170fi
171
172# Install the PK file carefully, since others may be doing the same
173# as us simultaneously.
174
175mv $PKNAME $DESTDIR/pktmp.$$
176cd $DESTDIR
177mv pktmp.$$ $PKNAME
178chmod a+r $PKNAME
179showname $DESTDIR/$PKNAME
180
181}
182# end of main function definition
183
184
185if test -z "$REDIRECT"; then
186
187  showname()
188  {
189    echo "$@" > $TEMPDIR/mtout.$$
190  }
191
192  # Clean up on normal or abnormal exit.
193  trap 'cd /; test -f $TEMPDIR/mtout.$$ && cat $TEMPDIR/mtout.$$; rm -rf $TEMPDIR; trap "" 0; exit 0' 0 1 2 15
194
195  (generate) >&2
196
197else
198
199  showname()
200  {
201    echo "$@" >&$REDIRECT
202  }
203
204  # Clean up on normal or abnormal exit.
205  trap 'cd /; rm -rf $TEMPDIR; trap "" 0; exit 0' 0 1 2 15
206
207  generate
208
209fi
Note: See TracBrowser for help on using the repository browser.