1!!/bin/sh
2!
3!   This script file makes a new TeX PK font, because one wasn't
4!   found.  Parameters are:
5!
6!   name dpi bdpi magnification [mode]
7!
8!   `name' is the name of the font, such as `cmr10'.  `dpi' is
9!   the resolution the font is needed at.  `bdpi' is the base
10!   resolution, useful for figuring out the mode to make the font
11!   in.  `magnification' is a string to pass to MF as the
12!   magnification.  `mode', if supplied, is the mode to use.
13!
14!   Note that this file must execute Metafont, and then gftopk,
15!   and place the result in the correct location for the PostScript
16!   driver to find it subsequently.  If this doesn't work, it will
17!   be evident because MF will be invoked over and over again.
18!
19!   Of course, it needs to be set up for your site.
20!
21!
22$   set mess/nofa/nose/note/noid
23$   newtex
24$   set mess/se/fa/id/te
25$ NAME = f$sear("mf_inputs:"+p1+".mf")
26$ onlyname=f$parse(name,,,"name")
27$ name= f$parse(name,,,"device")+f$parse(name,,,"directory")+f$parse(name,,, -
28      "name")
29$ DPI  = f$integer(P2)
30$ BDPI = f$integer(P3)
31$ MAG  = f$edit(P4,"LOWERCASE")
32$ MODE = P5
33$ if MODE .EQS. "" then
34$   if BDPI .EQ. 300
35$   then
36$      MODE := "imagen"
37$      goto GotMode
38$   endif
39$   if BDPI .EQ. 400
40$   then
41$      MODE := "nexthi"
42$      goto GotMode
43$   endif
44$   if BDPI .EQ. 100
45$   then
46$      MODE := "nextscreen"
47$      goto GotMode
48$   endif
49$   if BDPI .EQ. 635
50$   then
51$      MODE := "linolo"
52$      goto GotMode
53$   endif
54$   if BDPI .EQ. 1270
55$    then
56$      MODE := "linohi"
57$      goto GotMode
58$   endif
59$   if BDPI .EQ. 2540
60$    then
61$      MODE := "linosuper"
62$      goto GotMode
63$   endif
64$   write sys$output "I don't know the mode for ",BDPI
65$   write sys$output "Have your system admin update MakeTeXPK"
66$   exit 1
67$ GotMode:
68$
69$ GFNAME = f$fao("!AS.!ASgf",onlyNAME,f$string(DPI))
70$ PKNAME = f$fao("!AS.!ASPK",onlyNAME,f$string(DPI))
71$
72$ pkfilename = f$fao("tex_pk:!AS",PKNAME)
73$ pkfile = f$search (pkfilename)
74$ if pkfile .EQS. ""
75$ then
76$!    Clean up on normal or abnormal exit
77$     on control_y then goto ControlY
78$     on error then goto ControlY
79$     on severe_error then goto ControlY
80$
81$     OLDDIR = f$environment("DEFAULT")
82$     set def sys$login
83$     command = f$fao  -
84  ("mf ""\mode:=!AS; mag:=!AS; scrollmode ; input !AS""", -
85  MODE,MAG,NAME)
86$     write sys$output "Creating font file for ",onlyname
87$     write sys$output "Please wait about 2 minutes"
88$     write sys$output ""
89$     set noon
90$     command
91$     set on
92$
93$     gffile=f$sear(onlyname+"."+f$str(dpi)+"gf")
94$     if gffile .EQS. ""
95$     then
96$         write sys$output "Metafont failed for some reason on ",gfname
97$         goto ControlY
98$     endif
99$
100$     gftopk  'gfname'
101$     delete/noconf/nolog 'gfname';
102$     delete/noconf/nolog 'onlyname'.lis;
103$
104$   if f$getsyi("nodename").eqs."VAXSNS"
105$   then
106$     on error then goto goodexit
107$     on severe_error then goto goodexit
108$     send/file/vms 'pkname' newtex
109$!     write sys$output "------- ",pkname," has been sent to NEWTEX"
110$     send/file/vms 'onlyname'.tfm newtex
111$!     write sys$output "------- ",onlyname,".TFM has been sent to NEWTEX"
112$   endif
113$
114$     goto GoodExit
115$ else
116$     write sys$output "tex_pk:",PKNAME," already exists!"
117$     exit
118$ endif
119$
120$
121$ GoodExit:
122$   set default 'olddir
123$   exit
124$
125$ ControlY:
126$   set default 'olddir
127$   exit 1
128