home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
text
/
tex
/
pastex
/
mf
/
rexx
/
maketexfont.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-06-01
|
14KB
|
501 lines
/*
** AREXX $VER: MakeTeXFont 1.05
**
** Send new features and bug reports to
**
** Martin Bokaemper
** Reuthstr. 12
** 91099 Poxdorf
** Germany
**
** Email: mnbokaem@cip.e-technik.uni-erlangen.de (Internet)
** mab@ame.zer (Zerberus)
**
** Ulrich Wisser
** Heerstr. 125
** 53111 Bonn
**
** HISTORY:
**
** 0.80: My 'works-fine-for-me' version modified by Georg Hessmann 13.04.91
** + Variables for all directories and filenames
** + ^C and ^D detection
** + support for a 'modefile' containing site-specific information
** + searches for standard magsteps
** + support for different format-files
**
** 0.81: + take new Parameters 'drivertype' and 'pkfilename'
** Georg Hessmann 17.04.91
**
** 0.82: + History
** + a lot of small improvements and bugfixes
** + looking for PK-directory for each device
** + checking if the font already exists
** Martin Bokaemper 21.04.91
**
** 0.84: + add new parameter 'pkdir' (new since driver version V1.10)
** Georg Hessmann 09.06.91
**
** 0.85: + fixed a pkdir/pkfilename mixing bug
** + slight modifications, now works with old driver versions
** + changed exit codes
** + always calls uses plain.base (absolutely no gain in using cmbase)
** J\"org H\"ohle 24.6.91, 01.08.91
**
** 0.86: + fixed makedir(pkname) bug
** J\"org H\"ohle 06.08.91
**
** 0.90: + add makedir(pkdir)
** + delete localfont entry in 'modes' file
** Georg Hessmann 28.08.91
**
** 1.00: + only one logfile entry per call
** + ERROR: now reports interpreted sourceline
** + fonts can be copied to mf:<mode> for font-caching
** + magstep calculation improved. now same as in ShowDVI/DVIPrint
** + MISSING: \scrollmode correctly inserted
** Ulrich Wisser 25.08.92
**
** 1.01: + bumped revision number because of partial integration of
** + versions 0.91 and 1.0 and some personal modifications.
** Andreas Scherer 31.10.93
**
** 1.02: + negative magnification factors and dpi values installed.
** Andreas Scherer 18.01.94
**
** 1.03: + support for dvips 5.523 resulted in a modified analysis of
** + the `modes' file. PKDIR now *always* comes as an argument
** + of this script (as implemented by Ulrich Wisser).
** Andreas Scherer 19.01.94
**
** 1.04: + METAFONT 2.71 returns 0, 5, 10, and 20, so a different ERROR
** + handling is necessary (and possible).
** Andreas Scherer 2.5.94
**
** 1.05: + add MyGetEnv at the end of the file
** + add ENV:MFLOGDIR to change the logging directory
** Change default to T:MFlog.
** + add ENV:MFTMPDIR to change the working directory
** The directory, where virmf will be started. MF: isn't
** a good choice, because this can be on a CD-ROM (ro).
** Change default woring directory from MF: to T:
** + use the PKDIR from the argument, not from the TeX:config/modes
** file. This dir variable is renamed to MODEPKDIR but is noop.
** Georg Heßmann 13.05.94
*/
Signal On BREAK_C
Signal On BREAK_D
/*
** Files / Directories
*/
LOGDIR = Word(MyGetEnv("MFLOGDIR"),1) /* not to MF: .. it could be on CD-ROM */
If "" = LOGDIR Then
LOGDIR = "T:MFlog" /* directory of the logfiles */
/* without trailing slash! */
WORKDIR = Word(MyGetEnv("MFTMPDIR"),1) /* working directory */
If "" = WORKDIR Then /* not MF: .. it could be on CD-ROM */
WORKDIR = "T:"
LOGNAME = LOGDIR"/MakeTeXFont.log" /* logfile */
MODEFILENAME = "MF:config/modes" /* description of the modes */
TEXTFM = "TeX:fonts/" /* TeX tfm-files directory */
VIRMF = "MF:bin/VirMF"
GFTOPK = "MF:bin/GFtoPK"
FONTFILENAME = "TeX:config/fontvols"
/*
** Bases. Put in others, if you like.
*/
NORMALBASE = "plain"
DXBASE = "dxbase" /* base for dc-fonts */
CMBASE = "cmbase" /* base for cm-fonts */
/*
** Arguments
*/
Parse Arg FNTNAME DPI HBASEDPI VBASEDPI DRIVERTYPE PKFILENAME PKDIR .
Say "Making font "FNTNAME" at "DPI" dpi and base ("HBASEDPI","VBASEDPI")"
If ~Show('Libraries','rexxsupport.library') Then Do
If ~AddLib('rexxsupport.library',0,-30) Then Do
Say "No RexxSupport.library ... No Metafont!"
Exit 5
End
End
DUMMY = Time("Reset")
If ~Exists(LOGDIR) Then Do
Address COMMAND 'MakeDir 'LOGDIR
If ~Exists(LOGDIR) Then Do
Call Log("Could not create logdir="LOGDIR)
Exit 5
End
Say "logfile-directory ("LOGDIR"/) did not exist. It was created."
End
If ~Exists(LOGNAME) Then Do
Address COMMAND 'echo >'||LOGNAME
If ~Exists(LOGNAME) Then Do
Call Log("Could not create logfile="LOGDIR"/"LOGNAME)
Exit 5
End
Say "logfile did not exist. It was created."
End
FNTNAME = Translate(FNTNAME,XRange('a','z'),XRange('A','Z')) /* lower */
DPI = Strip(DPI)
HBASEDPI = Strip(HBASEDPI)
VBASEDPI = Strip(VBASEDPI)
DRIVERTYPE = Translate(DRIVERTYPE,XRange('a','z'),XRange('A','Z')) /* lower */
PKFILENAME = Translate(PKFILENAME,XRange('a','z'),XRange('A','Z')) /* lower */
PKDIR = Translate(PKDIR,XRange('a','z'),XRange('A','Z')) /* lower */
/*
** Changed 19.07.92 by Ulrich Wisser
** Needed to calculate correct DPI sizes
*/
Numeric DIGITS 12
/*
** What magstep should the font have?
*/
MAG = DPI/HBASEDPI
/*
** MAGMULT.NUM.I set to correct values!
** 21.07.92 by Ulrich Wisser
** Needed to calculate correct DPI values.
**
** Some more values for magstep(-0.5)..magstep(-4) included.
** 18.01.94 by Andreas Scherer.
*/
MAGMULT.0 = 23 /* number of saved MagSteps */
MAGMULT.NUM.1 = 1.0 /* MagStep(0) */
MAGMULT.STR.1 = "0"
MAGMULT.NUM.2 = 1.09544511501 /* MagStep(0.5) */
MAGMULT.STR.2 = "0.5"
MAGMULT.NUM.3 = 1.2 /* MagStep(1) */
MAGMULT.STR.3 = "1"
MAGMULT.NUM.4 = 1.31453413801 /* MagStep(1.5) */
MAGMULT.STR.4 = "1.5"
MAGMULT.NUM.5 = 1.44 /* MagStep(2) */
MAGMULT.STR.5 = "2"
MAGMULT.NUM.6 = 1.57744096561 /* MagStep(2.5) */
MAGMULT.STR.6 = "2.5"
MAGMULT.NUM.7 = 1.728 /* MagStep(3) */
MAGMULT.STR.7 = "3"
MAGMULT.NUM.8 = 2.0736 /* MagStep(4) */
MAGMULT.STR.8 = "4"
MAGMULT.NUM.9 = 2.48832 /* MagStep(5) */
MAGMULT.STR.9 = "5"
MAGMULT.NUM.10 = 2.985984 /* MagStep(6) */
MAGMULT.STR.10 = "6"
MAGMULT.NUM.11 = 3.5831808 /* MagStep(7) */
MAGMULT.STR.11 = "7"
MAGMULT.NUM.12 = 4.29981696 /* MagStep(8) */
MAGMULT.STR.12 = "8"
MAGMULT.NUM.13 = 5.159780352 /* MagStep(9) */
MAGMULT.STR.13 = "9"
MAGMULT.NUM.14 = 0.91287092917 /* magstep(-0.5) */
MAGMULT.STR.14 = "-0.5"
MAGMULT.NUM.15 = 0.83333333333 /* magstep(-1) */
MAGMULT.STR.15 = "-1"
MAGMULT.NUM.16 = 0.76072577431 /* magstep(-1.5) */
MAGMULT.STR.16 = "-1.5"
MAGMULT.NUM.17 = 0.69444444444 /* magstep(-2) */
MAGMULT.STR.17 = "-2"
MAGMULT.NUM.18 = 0.63393814526 /* magstep(-2.5) */
MAGMULT.STR.18 = "-2.5"
MAGMULT.NUM.19 = 0.5787037037 /* magstep(-3) */
MAGMULT.STR.19 = "-3"
MAGMULT.NUM.20 = 0.52828178771 /* magstep(-3.5) */
MAGMULT.STR.20 = "-3.5"
MAGMULT.NUM.21 = 0.48225308641 /* magstep(-4) */
MAGMULT.STR.21 = "-4"
MAGMULT.NUM.22 = 0.44023482309 /* magstep(-4.5) */
MAGMULT.STR.22 = "-4.5"
MAGMULT.NUM.23 = 0.40187757201 /* magstep(-5) */
MAGMULT.STR.23 = "-5"
MAGMULT.STR.DEFAULT = "???"
MAGSTR = MAGMULT.STR.DEFAULT
/*
** Changed 21.07.92 by Ulrich Wisser
** DPI rounding caused troubles sometimes, e.g., for
** magstep2 with ShowDVI 44x44
*/
Do I = 1 To MAGMULT.0
MAGDPI = (MAGMULT.NUM.I * HBASEDPI) + 0.5
If Pos('.',MAGDPI) > 0 Then
MAGDPI = Left(MAGDPI,Pos('.',MAGDPI)-1)
If MAGDPI = DPI Then Do
MAG = MAGMULT.NUM.I
MAGSTR = MAGMULT.STR.I
Leave I
End
End
If MAGSTR ~= MAGMULT.STR.DEFAULT Then MAG = 'magstep('magstr')'
/*
** Modes ... search the correct mode in the file MODEFILENAME (see above).
*/
If ~Open('MODEFILE',MODEFILENAME,'READ') Then Do
Call Log("Can't find file "MODEFILENAME"!")
Exit 5
End
Do Until(XRES==HBASEDPI & YRES==VBASEDPI) | EOF('MODEFILE')
LINE = ReadLn('MODEFILE')
LINE = Strip(T