/*************************************************************************/
/* PRINTFONTS.REXX  will bring up a file requestor where you may choose  */
/* one of the EPSON LQ font files.  This script will then download that  */
/* font to the printer and print out a short (6 line) test file for you  */
/* to see how the output will look.  I would suggest you download all of */
/* the printer fonts so that you will have a handy hardcopy reference    */
/* for future use.   12-3-90  Mike Mantino                               */
/*************************************************************************/


OPTIONS RESULTS

cdir = 'ram:'
LF = '0A'X
HEADDATA = '1B 78 01 1B 50 1B 3A'X
NAMETEXT = '[FONT NAME]------>  '
TESTTEXT = 'TESTING LQ-800 downloadable fonts:' LF LF, 
		 '! @ # $ % ^ & * ( ) _ + | \ - { } [ ] :  ;  < > ? , . /' LF LF ,
		 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' LF LF ,
		 'abcdefghijklmnopqrstuvwxyz' LF LF ,
		 '1 2 3 4 5 6 7 8 9 0' LF LF LF LF LF


call PostMsg(5,5,"Be certain that printer dip-switch\number 1-4 is
 set to the OFF position\to create buffer space for the fonts.\Also
 note that it takes about 5 secs.\for the font to be installed.")


call ASKME
exit 0


ASKME:

REQPATH = getfile(340,15,cdir,,'SELECT A FONT TO TEST')

call PostMsg()

if REQPATH = "" then exit 0

FNTPATH = REQPATH

colonpos = lastpos(":",REQPATH)
slashpos = lastpos("/",REQPATH)

if left(statef(REQPATH),1) = "F" then
  do /*  This is a file, not just a directory  */
    if slashpos > 0 then
      do /*  At least one subdirectory has been given  */   
        cdir = substr(REQPATH,1,slashpos-1)
        REQPATH = substr(REQPATH,slashpos+1)
      end
      else
    if colonpos > 0 then
      do /*  A main directory has been given  */
        cdir = substr(REQPATH,1,colonpos)
        REQPATH = substr(REQPATH,colonpos+1)
      end
  end
else
  if slashpos > 0 | colonpos > 0 then
  exit 0

if REQPATH = "" then exit 0

FNTNAME = REQPATH

call open(FP,FNTPATH,'Read')
if readch(FP,7) ~== HEADDATA then
	call NOTFONT
call close(FP)

address command 'copy' FNTPATH 'par:'
call open(prntr,'par:','Write')
call writech(prntr,NAMETEXT || FNTNAME || LF || LF)
call writech(prntr,TESTTEXT)
call close(prntr)
call TRYAGAIN

return 0



NOTFONT:

call close(FP)
result = Request(150,110,'NOT AN LQ PRINTER FONT. TRY AGAIN?',,'OKAY','NOPE')
if result = 'OKAY' then call ASKME
     else exit 0

return 0



TRYAGAIN:

result = Request(150,110,'Test Another Font?',,'OKAY','NOPE')
if result = 'OKAY' then call ASKME
     else exit 0

return 0



PRINTIT:

address command type FDIR || 'fntname' par:
address command type nametext || fntname par:
address command copy testtext par:

return 0

