home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 58 / af058b.adf / PV21.lha / PV_Import / ConvertPSfont next >
Text File  |  1992-08-19  |  3KB  |  102 lines

  1. /* ConvertPSfont --- Intuition Front-End (rexxarplib) for 
  2.     PSImport Type1 font conversion.  Copyright 1992 by Stylus, Inc.
  3.  
  4. USAGE:
  5.     * Double-click the macro icon.
  6.     * Select font(s) to be converted from file requester.
  7.         (It will support multiple selection under AmigaDOS 2.0.)
  8.  
  9. KNOWN BUGS:
  10.     * If source or destination is "Ram Disk:*" this macro will fail.
  11.         (Don't blame me, I didn't name a device "Ram Disk:"   :^)
  12. */
  13.  
  14.  
  15. call open STDOUT,"RAM:RxOut.txt",W
  16. call open STDERR,"RAM:RxErr.txt",W
  17. trace R
  18.  
  19. if ~show('L',"rexxsupport.library") then call addlib "rexxsupport.library",0,-30,0
  20.  
  21. /* Requires "rexxarplib.library" to call file requester */
  22. if ~exists("LIBS:rexxarplib.library") then
  23.     do
  24.         say "Requires REXXARPLIB.LIBRARY in LIBS:!"
  25.         exit
  26.     end
  27. else
  28.     do
  29.         if ~show('L',"rexxarplib.library") then call addlib "rexxarplib.library",0,-30,0
  30.     end
  31.  
  32. /* test for presence of c:RequestFile to determine OS version, ASL/ARP, etc.*/
  33. if exists("c:RequestFile") then DOS = 3
  34.  
  35. /* test for presence of ASL to determine OS version, ASL/ARP, etc.*/
  36. if ~exists("LIBS:asl.library") then OldDOS = T
  37.  
  38. address command
  39.  
  40. /* Get current PSImportPath for restoring */
  41. success = open(ENV,"ENV:PSImportPath",R)
  42. if success = 1 then do
  43.     EnvPath = readln(ENV)
  44.     call close ENV
  45.     end
  46. else EnvPath = "SYS:"
  47.  
  48. /* If OS 3.0 we can use RequestFile */
  49. if DOS = 3 then
  50. do
  51.     address command 'RequestFile Pattern "#?.PFB" Title "Select Font" AcceptPattern "#?.PFB" MultiSelect NoIcons'
  52.     EXIT
  53. end
  54.  
  55. AGAIN:
  56. /* if OS 1.3 get one font, convert, and loop back to here */
  57. if OldDOS = T then
  58.     do
  59.         FontPath = getfile(175,50,"#?.PFB",,"Select a Source FontName.PFB")
  60.         if FontPath = "" then
  61.             do
  62.                 say "Program cancelled!"
  63.                 exit
  64.             end
  65.         call ConvertFont
  66.         call Again
  67.     end
  68.  
  69. /* If OS 2.0, we can multi-select and batch process fonts */
  70. /* Initialize options string for ASL file requester */
  71. FRoptions = "PATGAD,MULTISELECT"
  72. /* Call file requester to get source fonts (Use ENVPATH ? */
  73. call GetFile(175,50,,,"Select a Batch of Fonts",,FRoptions,FontList,,,"#?.PFB")
  74. if FontList.0 = 0 then 
  75.     do
  76.         say "Program cancelled!"
  77.         exit
  78.     end
  79.  
  80. /* Loop through batch list of fonts */
  81. do i=1 to FontList.0
  82.     FontPath = FontList.i
  83.     call ConvertFont
  84. end
  85.  
  86. /* Restore PSImportPath */
  87. success = open(ENV,"ENV:PSImportPath",W)
  88. if success = 1 then do
  89.     call writeln(ENV,EnvPath)
  90.     end
  91.  
  92. call delay(100)
  93. EXIT
  94.  
  95. CONVERTFONT:
  96.     /* Mass concatentation */
  97.     ConvertFont = "'PV_Import:PSImport File="||FontPath||" Type1=True NewColors=False AskUser=False"||"'"
  98.     say "Converting " ||FontPath|| "!"
  99.     interpret ConvertFont
  100.     say ""
  101.     return
  102.