--- title: "QROFF Postscript Filter" type: "article" slug: "qroff-postscript-filter" url: "http://localhost/article/qroff-postscript-filter/" markdown_url: "http://localhost/article/qroff-postscript-filter.md" published_at: "2025-11-21T19:07:19+00:00" modified_at: "2026-06-21T23:23:33+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "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…" category: - name: "QL Hacker's Journal" slug: "ql-hackers-journal" taxonomy: "category" url: "http://localhost/category/periodicals/ql-hackers-journal/" post_tag: - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "QL" slug: "ql" taxonomy: "post_tag" url: "http://localhost/tag/ql/" - name: "Superbasic (programming language)" slug: "superbasic-programming-language" taxonomy: "post_tag" url: "http://localhost/tag/superbasic-programming-language/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Sinclair QL" slug: "sinclair-ql" taxonomy: "model" url: "http://localhost/model/sinclair-ql/" indiv: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" publication_r: id: 33686 title: "QL Hacker’s Journal" type: "periodical" url: "http://localhost/periodical/ql-hackers-journal/" authors_r: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" issue: "5" issues_articles: - id: 61541 title: "QL Hacker’s Journal 5" type: "issue" url: "http://localhost/issue/ql-hackers-journal-4-2/" pubdate: "August 1991" archive_link: true --- # QROFF Postscript Filter 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 ```