/* Here you get an overview about your fonts
 © Heiko Schröder / 96/09/16 / Mail: s93324@fh-telekom-leipzig.de */
R='0A'X
say Center("FontLook-Auto V2.51   - 96/09/16 -",74)
say Center("ARexx-Macro for FinalWriter from",74)
say " "
say Center("Heiko Schröder",74)
say Center("Arnoldstr. 1",74)
say Center("04299 Leipzig",74)
say Center("E-Mail: s93324@fh-telekom-leipzig.de",74)
say R||R

a=Show("PORTS")
pos1=Pos("FINALW.",a)
pos2=Pos(" ",a,pos1)
if pos2~=0 then
   a=DelStr(a,pos2)
FW=DelStr(a,1,pos1-1)
address(FW)

SIGNAL ON BREAK_C
Options Results

'ShowMessage 2 0 "FONTLOOK - AUTO v2.51" "for Font-Directories..." "(©) Heiko Schröder - 96/09/16" ":-)" "Ok" "(-:"'
'ShowMessage 1 1 "A T T E N T I O N !" "The macro needs an empty document." "Clear the document?" "Yes" "Abort" ""'
if result=2 then call BREAK_C
Cleardoc Force

'ShowMessage 2 1 "codes or layout" "" "" "codes" "layout" ""'
cl=result

/*----------------------------------- REXXREQTOOLS ------------------------*/

Temp = "ram:font"
if ~show('L',"rexxreqtools.library") then do
   if ~addlib('rexxreqtools.library',0,-30,0) then do
      'ShowMessage 1 1 "Error...." "I need the RexxReqTools.library" " E N D ! !" "Okay" "" ""'
      exit
   end
end

dir=rtfilerequest(,,"Select a directory...","»·ok·«","rtfi_flags = freqf_nofiles")
if dir="" then do
   'ShowMessage 1 1 "No directory selected!" " E N D ! !" "" "Okay" "" ""'
   exit
end
dir=d2c(34)||dir||d2c(34)
address command 'list ' dir || ' to=' Temp || ' files lformat "%s%s"'

if OPEN('file',Temp,"R") then
If Seek("file",0,"E")=0 then do
   'ShowMessage 1 1 "Directory is empty!" " E N D ! !" "" "Okay" "" ""'
   address "REXX"
   close("file")
   EXIT
end
address "REXX"
close("file")
address command 'sort ' Temp Temp
OPEN('file',Temp, "R")

address(FW)
'ShowMessage 1 1 "Do you need perforation signs?" "" "" "Yes" "No" ""'
lm=result
'ShowMessage 1 1 "Whats next?" "" "" "save" "print and save" "print"'
wgw=result

/*---------------------------*/

DO WHILE 1
	FontName=ReadLn('file')
	IF EOF('file') THEN do
      close('file')
      call Ende
   End

   TextTool
   Font FontName
   a=RC
   If a=0 then do                  /* Font?*/

      Type d2c(32)
      BackSpace
      status FontPath
      FullFontName=result
      pos=LASTPOS('/', FullFontName)
      IF (pos~=0) THEN
   	   FontName=RIGHT(FullFontName, LENGTH(FullFontName)-pos)
      ELSE 	DO
   	   pos=LASTPOS(':', FullFontName)
   	   IF (pos~=0) THEN
   	   	FontName=Right(FullFontName, LENGTH(FullFontName)-pos)
      	ELSE
       	EXIT
   	END

      GraphicTool
      LinePrefs LineWt .5

      If lm=1 then DrawLine 1 0.5 14.85 1 14.85

      If cl=1 then do
         DrawLine 1 2 3.5 20 3.5
         DrawLine 1 2 26 20 26
         TextTool
         Pagesetup Pagetype A4 Orient Tall Top 0 Bottom 2.54 Left 0 Right 0
         SectionSetup Top 2.54 Bottom 2.54 Inside 2 Outside 1

         Do i=0 to 13
            SetTab i*1.3+0.8 Right
         End
   
         NameFont="FWDocs/Codes-" || FontName
         Justify Center
         Font Softsans
         FontSize 18
         Type FontName||R||R

         Justify Left

         a=0

         DO w=1 to 15

            Font Softsans
            FontSize 8
            DO x=a+33 to a+46
         	   Type d2c(9) || x || d2c(32) || d2c(x)
            END

            Type R

            Font FontName
            FontSize 24
            DO x=a+33 to a+46
            	Type d2c(9)
               Type d2c(x)
            END

            Type R

            a=a+14

         END

         Font Softsans
         FontSize 8
         DO x=a+33 to a+45
         	Type d2c(9) || x || d2c(32) || d2c(x)
         END

         Type R

         Font FontName
         FontSize 20
         DO x=a+33 to a+45
         	Type d2c(9)
            Type d2c(x)
         END
         Type R
         FontSize 12
         Type d2c(9)||R
         Font Softsans

         FontSize 8
         Justify Right
         Type Date(O)

      END

      If cl=2 then do
         DrawLine 1 2 3.4 20 3.4
         TextTool
         Pagesetup Pagetype A4 Orient Tall Pages RightOnly Top 0 Bottom 2.54 Left 0 Right 0
         SectionSetup Top 2.54 Bottom 2.54 Inside 2 Outside 1

         Justify Center
         NameFont="FWDocs/Layout-" || FontName
         Font Softsans
         FontSize 18
         Type FontName||R

         Justify Left
         Font FontName
         FontSize 8
         Type R||"This is 8-point type - not easy to read!"||R

         FontSize 9
         Type "9-Point type is about the smallest readable size."||R

         FontSize 10
         Type "With 10-point type, we have a normal text size."||R

         FontSize 12
         Type "With some fonts, 12-point type is easier to read."||R

         FontSize 14
         Type "14-point type is good for subheadings."||R

         FontSize 16
         Type "For larger subheadings, try 16-point type."||R

         FontSize 18
         Type "18-point type makes nice small headlines."||R

         FontSize 24
         Type "24-point type is for medium headlines."||R

         FontSize 36
         Type "36-point is for larger ones."||R

         FontSize 48
         Type "48-point almost shouts!"||R

         FontSize 60
         Type "60-point is huge!"||R

         FontSize 12
         Font SoftSans
         Type "NORMAL"||R
         Font FontName
         Type "ABCDEFGHIJKLMNOPQRSTUVWXYZ"||R
         Type "abcdefghijklmnopqrstuvwxyz 1234567890 !@#$%^&*()-+=[]{}/:;,.?"||R
         Type "The quick brown fox jumps over the lazy dog."||R||R

         Font SoftSans
         Type "Extended Characters"||R
         Font FontName
         j=0
         Do i=1 to 4
            Do k=128+j to 159+j
               Type d2c(k)
            End
            Type R
            j=j+32
         End
      End

      If wgw=1 then do      /* save */
         Save NameFont
         Cleardoc
      end

      If wgw=2 then do      /* save+print */
         Save NameFont
         Print
         Cleardoc
      end

      If wgw=3 then do      /* print */
         Print
         Cleardoc force
      end
   end
   else do
      pos=LastPos("/",FontName)
      FontName=Right(FontName,Length(FontName)-pos)
      say d2c(11)||d2c(11)||"FW cant display the following font: "||FontName
      say Copies(" ",50)||d2c(11)
   end
END

Ende:
address(FW)
If cl=1 then 'ShowMessage 2 1 "You can find the documents in the" " FWDocs-Drawer. Recognizable on «Codes-.....«" "Thanx for use." "@-`-" "Please" ":-))"'
If cl=2 then 'ShowMessage 2 1 "You can find the documents in the" " FWDocs-Drawer. Recognizable on «Layout-.....«" "Thanx for use." "@-`-" "Please" ":-))"'

EXIT

BREAK_C:
   'ShowMessage 1 1 "Macro aborted..." "" "" "I know..." "" ""'
   address "REXX"
	CLOSE("file")
	SAY 'Macro aborted...'
	EXIT
