home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / pmcstex.zip / install / cmd.CS / MAKE_PK.CMD < prev    next >
OS/2 REXX Batch file  |  2000-04-03  |  5KB  |  212 lines

  1. /*
  2.  
  3. Pro svou instalaci OS/2 upravil Kuben (kuben@scova.vabo.cz) podle verze 
  4. dodané k dvips, 23.5.1998.
  5. Translated from Piet Tutelaar's Unix shell script
  6. into Rexx by Sebastian Rahtz, 15.8.92 (spqr@minster.york.ac.uk)
  7.  
  8. ===================================================================================
  9.  
  10.    This script file makes a new TeX PK font, because one wasn't
  11.    found.  Parameters are:
  12.  
  13.    name dpi bdpi magnification [[mode] subdir]
  14.  
  15.    `name' is the name of the font, such as `cmr10'.  `dpi' is
  16.    the resolution the font is needed at.  `bdpi' is the base
  17.    resolution, useful for figuring out the mode to make the font
  18.    in.  `magnification' is a string to pass to MF as the
  19.    magnification.  `mode', if supplied, is the mode to use.
  20.  
  21.    První se budou hledat T1 fonty v souboru EMTEXDIR\DATA\DVIPS\adobe.sez.
  22.    Pokud se najdou, bude spuτten program ps2pk.
  23.    V opaƒném p²ípad╪ bude spuτt╪n maketexp.cmd.
  24.  
  25. */
  26.  
  27.  
  28. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  29. call SysLoadFuncs
  30. os2env='OS2ENVIRONMENT'
  31.  
  32. /****  SENSIBLE SETUP VALUES  ****/
  33.  
  34. /* The emtex base directory default when EMTEXDIR is not set */
  35. EMTEXDIR_DEFAULT='d:\emtex'
  36.  
  37. /* base path for emtex */
  38. EMTEXDIR=value('EMTEXDIR','',os2env)
  39. if EMTEXDIR='' then do
  40.         EMTEXDIR=EMTEXDIR_DEFAULT
  41. end
  42.  
  43. /* Verze ghostscriptu */
  44. GS_VER=601
  45.  
  46. /* The T1INPUTS default directories, when T1INPUTS is not set */
  47. T1INPUTS_DEFAULT=EMTEXDIR'\GS\GS'GS_VER'\fonts;'EMTEXDIR'\DATA\DVIPS\FONTY;'EMTEXDIR'\DATA\DVIPS'
  48.  
  49. /* The TEXCONFIG default directory, when TEXCONFIG is not set */
  50. TEXCONFIG_DEFAULT=EMTEXDIR'\data\dvips'
  51.  
  52. /* The DVIDRVFONTS default directory, when DVIDRVFONTS is not set */
  53. DVIDRVFONTS_DEFAULT=EMTEXDIR'\texfonts'
  54.  
  55.  
  56. PARSE Arg all_args
  57. argc=words(all_args)
  58. if ( argc < 4  | argc > 5 ) then
  59. do
  60.    say "Usage: make_pk fontname dpi bdpi magnification [mode]"
  61.    exit 1
  62. end
  63.  
  64. /* Where we look for Type1 fonts and AFM files */
  65. T1INPUTS=value('T1INPUTS',,os2env)
  66. if T1INPUTS='' then
  67. do
  68.         T1INPUTS=value('T1INPUTS',T1INPUTS_DEFAULT,os2env)
  69.         T1INPUTS=value('T1INPUTS',,os2env)
  70. end
  71.  
  72.  
  73. /* Where we look for dvips stuff */
  74. TEXCONFIG=value('TEXCONFIG',,os2env)
  75. if TEXCONFIG='' then do
  76.         TEXCONFIG=TEXCONFIG_DEFAULT
  77. end
  78. listoftype1files=TEXCONFIG'\adobe.sez'
  79.  
  80.  
  81. NAME=word(all_args,1)
  82. DPI=word(all_args,2)
  83. BDPI=word(all_args,3)
  84. MAG=word(all_args,4)
  85. if argc > 4 then
  86.         MODE=word(all_args,5)
  87. else
  88.    if BDPI = 300   then
  89.       MODE='laserjet'
  90.    else if BDPI = 600    then
  91.       MODE='laserjetIV'
  92.    else if BDPI = 1270   then
  93.       MODE='linohi'
  94.    else if BDPI = 2540   then
  95.       MODE='linosuper'
  96.    else
  97.     do
  98.       say 'I do not know the mode for ' BDPI
  99.       say 'update this Make_PK script'
  100.       exit 1
  101.     end
  102.  
  103. /* destination of pk files */
  104. DVIDRVFONTS=value('DVIDRVFONTS',,os2env)
  105. if DVIDRVFONTS = '' then
  106.         DVIDRVFONTS=DVIDRVFONTS_DEFAULT
  107. if  MODE='laserjet' then
  108.         DESTDIR=DVIDRVFONTS'\LJ'
  109. else if MODE='deskjet' then
  110.         DESTDIR=DVIDRVFONTS'\DJ'
  111. else if MODE='laserjetIV' then
  112.         DESTDIR=DVIDRVFONTS'\LJH'
  113. else if MODE='epsonfx' then
  114.         DESTDIR=DVIDRVFONTS'\FX'
  115. else if MODE='lqlores' then
  116.         DESTDIR=DVIDRVFONTS'\LQL'
  117.  
  118.  
  119. say 'making for ' MODE ' in ' DESTDIR
  120. call sysfiletree DESTDIR ,'test', 'OD'
  121. if test.0=0 then
  122.       call SysMkDir DESTDIR
  123. SUBDIR='dpi'DPI
  124. DESTDIR=DESTDIR'\'SUBDIR
  125. call sysfiletree DESTDIR ,'test', 'OD'
  126. if test.0=0 then
  127.       call SysMkDir DESTDIR
  128.  
  129. PKNAME=NAME'.pk'
  130. destpk=DESTDIR'\'PKNAME
  131.  
  132. fname = stream(destpk , 'C', 'QUERY EXISTS')
  133. if \ (fname ='') then
  134.   do
  135.      say DESTDIR'\'PKNAME 'already exists!'
  136.     exit 0
  137.   end
  138.  
  139. /* OK, try to make the font by some means */
  140.  
  141. /* first try Adobe Type1 fonts */
  142.  
  143. file.0=0
  144. call sysfilesearch NAME' ', listoftype1files, 'FILE.', 'C'
  145. /* if that succeeded, the variable FILE contains the
  146. matching lines in the file describing the fonts */
  147. if rc=3 then
  148. do
  149.    say 'You should install file ' listoftype1files
  150.    exit 0
  151. end
  152. ZDROJ=''
  153. KODOVANI=''
  154. SKLON=''
  155. ROZSIRENI=''
  156. if FILE.0>0 then
  157.    do i=1 to file.0
  158.         if word(file.i,1)=NAME then
  159.                 do
  160.                 ZDROJ=word(file.i,2)
  161.                 if \ (word(file.i,3) = 'NE') then
  162.                    KODOVANI=word(file.i,3)
  163.                 if \ (word(file.i,4) = 'NE') then
  164.                    SKLON=word(file.i,4)
  165.                 if \ (word(file.i,5) = 'NE') then
  166.                    ROZSIRENI=word(file.i,5)
  167.                 leave
  168.                 end
  169.    end
  170. if ZDROJ='' then  /* failed to locate a name in the list */
  171. do
  172.         say 'No entry for PS font'  NAME 'in' listoftype1files||'.'
  173.         say 'METAFONT will be tried.'
  174.         signal VOLAT_MF
  175. end
  176.  
  177. /* CELYZDROJ=syssearchpath('T1INPUTS',ZDROJ)  */
  178. /* T1INPUTS musí b∞t stavová prom╪nná */
  179. CELYZDROJ=syssearchpath('T1INPUTS',ZDROJ)
  180.         say 'Result of PFB search: 'CELYZDROJ
  181.         if CELYZDROJ='' then
  182.         do
  183.               say 'Sorry, no PostScript font found'
  184.               exit 1
  185.         end
  186.  
  187. ZVETSENI=bdpi * mag
  188.  
  189. if \ (KODOVANI='') then
  190.   KODOVANI='-e '||KODOVANI
  191.  
  192. if \ (SKLON='') then
  193.   SKLON='-S '||SKLON
  194.  
  195. if \ (ROZSIRENI='') then
  196.   ROZSIRENI='-E '||ROZSIRENI
  197.  
  198. job='ps2pk -v ' KODOVANI '-X '||ZVETSENI SKLON ROZSIRENI ZDROJ DESTPK
  199.  
  200. /* say job */
  201. job
  202. exit 0
  203.  
  204. VOLAT_MF:
  205. job='call maketexp.cmd' NAME DPI BDPI MAG MODE
  206. /* say job */
  207. job
  208.  
  209. /* say "Konec" */
  210.  
  211. exit 0
  212.