I know of a few QL users that have postscript printers at work and transfer QL documents to another word processor to format and print out on the postscript printer. For some this is time consuming. I have written a NROFF-like text to postscript text formater. It basically allows the user to input a text file and get a postscript printable version of the file. It does not do much formating beyond allowing the use of multiple fonts and font sizes.
Commands are similar to those used in the QHJ print formatter. Commands are:
.PB - Page Break
.FT XX - Font Type
(See code for supported font types)
.PS XX - Change Font Size.
I plan the expand the capabilities of QROFF. I first have to better understand poscript programming. Eventually I hope to make the program compatable with Unix TROFF/NROFF.
How soon these features are added can depend upon interest. If a number of people can use the program, I give it higher priority in my queue.
Below is the SSB source code:
** QROFF Text To Postscript Filter
** by Timothy Swenson
OPEN #5,con_250x150a75x0_32
PAPER #5,0 : INK #5,4
CLS #5 : PRINT #5,\
BORDER #5,4,2
PRINT #5," QROFF Text To Postscript Filter"
PRINT #5," by Timothy Swenson"\\
PRINT #5," (Enter Full File Names)"
PRINT #5,"Enter Name of File:"
INPUT #5,infile$
PRINT #5,"Enter Output File:"
INPUT #5,outfile$
OPEN_IN #4,infile$
DELETE outfile$
OPEN_NEW #3,outfile$
CLS #5
STRIP #5,7
AT #5,10,10: PRINT #5," W O R K I N G "
STRIP #5,2
deffont = 12
font = deffont
deffontt$ = "Courier"
fontt$ = deffontt$
page = 1
count = 1
curpoint = 750
lmargin = 37
PRINT #3,"/";deffontt$;" findfont ";devfont;" scalefont
setfont"
REPeat loop
INPUT #4,in$
IF EOF(#4) THEN EXIT loop
IF in$=".pb" OR in$=".PB" THEN footer : NEXT loop
IF in$(1 to 3)=".ps" OR in$(1 to 3)=".PS" THEN
IF LEN(in$) <= 4 THEN errer(4)
temp$ = in$(5 to 6)
IF temp$=" " THEN errer(4)
font = ABS(temp$)
IF (font < 6) OR (font > 36) THEN errer(5)
PRINT #3,"/";fontt$;" findfont"
PRINT #3,font;" scalefont setfont"
NEXT loop
END IF
IF in$(1 to 3)=".ft" OR in$(1 to 3)=".FT" THEN
IF LEN(in$) <= 4 THEN errer(6)
temp$ = in$(5 to 6)
IF temp$="CO" OR temp$="co" THEN fontt$="Courier"
IF temp$="CB" OR temp$="cb" THEN fontt$=
"Courier-Bold"
IF temp$="CI" OR temp$="ci" THEN fontt$=
"Courier-Oblique"
IF temp$="CA" OR temp$="ca" THEN fontt$=
"Courier-BoldOblique"
IF temp$="TR" OR temp$="tr" THEN fontt$=
"Times-Roman"
IF temp$="TB" OR temp$="tb" THEN fontt$= "Times-Bold"
IF temp$="TI" OR temp$="ti" THEN fontt$=
"Times-Italic"
IF temp$="TA" OR temp$="ta" THEN fontt$=
"Times-BoldItalic"
IF temp$="HV" OR temp$="hv" THEN fontt$= "Helvetica"
IF temp$="HB" OR temp$="hb" THEN fontt$=
"Helvetica-Bold"
IF temp$="HO" OR temp$="ho" THEN fontt$=
"Helvetica-Oblique"
IF temp$="HA" OR temp$="ha" THEN fontt$=
"Helvetica-BoldOblique"
PRINT #3,"/";fontt$;" findfont ";font;" scalefont
setfont"
NEXT loop
END IF
PRINT #3,lmargin;" ";curpoint;" moveto"
PRINT #3,"(";
** Postscript is not tolerant of ('s, )'s, or \'s. You
** must precede each one with a \. Just like the C shell.
temp = "(" INSTR in$
temp = temp + ( ")" INSTR in$)
temp = temp + ( "\" INSTR in$)
IF temp > 0 THEN
FOR x = 1 to LEN(in$)
IF in$(x) = "(" THEN
PRINT #3,"\(";
ELSE
IF in$(x) = ")" THEN
PRINT #3,"\)";
ELSE
IF in$(x) = "\" THEN
PRINT #3,"\";
ELSE
PRINT #3,in$(x);
END IF
END IF
END IF
NEXT x
ELSE
PRINT #3,in$;
END IF
PRINT #3,") show"
count = count + 1
curpoint = curpoint - font
IF curpoint <= 30 THEN
footer
PRINT #3,"/";fontt$;" findfont ";font;" scalefont
setfont"
ENDIF
END REPeat loop
footer
CLOSE #3
CLOSE #4
DEFine PROCedure errer(err_num)
PRINT #5,"ERROR - Line Number: ";count
IF err_num = 4 THEN PRINT " Font Size Not Found."
IF err_num = 5 THEN PRINT " Font Size Not Out Of Range."
IF err_num = 6 THEN PRINT " Font Type Not Found."
CLOSE #3 : CLOSE #4 : CLOSE #5 : STOP
END DEFine errer
DEFine PROCedure footer
PRINT #3,"/";deffontt$;" findfont ";deffont;" scalefont
setfont"
PRINT #3,"150 20 moveto"
PRINT #3,"(PAGE ";page;") show"
PRINT #3,"showpage"
page = page + 1
curpoint = 750
END DEFine footer
Products
Downloadable Media
Image Gallery
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.