Classic Computer Magazine Archive COMPUTE! ISSUE 124 / DECEMBER 1990 / PAGE G-38

PROGRAMS
TEXT FITTER
PRINT TEXT IN COLUMNS OR HAVE IT FLOW IN WHATEVER SHAPE YOU DESIRE WITH THIS HANDY PRINTING UTILITY FOR THE 64

KEITH M. GROCE

There are times when it would be nice to print a word processor file in something other than the box you get from setting margins. For example, you might want to print on letterhead or stationery without running into the preprinted matter, leave space for photos or hand-drawn illustrations, turn your notes into 3 × 5 cards, or print the text of your annual Christmas letter in the shape of a Christmas tree.

This program is a convenient way for anyone who doesn't own a desktop publishing program yet may want to publish a simple newsletter and have text fit around a graphic or photograph. You can place text in columns, rectangles, or any other shape that fits your requirements, preview it on your monitor, and then have the finished product roll off your printer.

Text Fitter lets you set text boundaries for each line and then fill these areas from standard Commodore-ASCII sequential files. The boundaries, or text-limit lines, are drawn anywhere on an 80-column × 55-line page. Word-wrapped text is placed between limit lines. You may also save any text which has not been placed in a "leftover" file. Text Fitter prints only one page at a time. The program pours text in, filling your custom-designed page or shape. If you have more text in the file than is needed to fill the page, then the left-overs are saved and can be printed in another custom page or printed normally with your word processor.

Getting Started

Text Fitter consists of a BASIC program and machine language subroutines. The BASIC program should be entered with The Automatic Proof­reader; the machine language program, with MLX. See "Typing Aids" elsewhere in this section. When MLX prompts you, respond with the values given below.

Starting address: C000
Ending address:   C808

Once you've finished entering the data, save a copy to disk. The BASIC program loads the machine language program, so be sure to save the ML program as FITTER. ML.

Using the Program

Before using Text Fitter, you must create a source file. Any Commodore-ASCII sequential file (like those produced by Easy Script or by printing a file to disk with SpeedScript) is acceptable. Don't include control characters for underlining, italics, or the like in your text file because the results will be unsatisfactory.

When you load and run Text Fitter, a menu/help screen will be displayed. This screen lists all the commands to manipulate the text-limit lines. Press a key as indicated to move to the layout screen. Mark text-limit lines by moving the red and green cursors to the endpoints of the line you want to mark and pressing the M key. Marked lines will appear as a series of dashes on the layout screen. Connect lines to block out areas of text and non-text. (Note that the printing area edges are also text limits.) The layout screen displays the cursor positions in terms of column/line count and inches as measured from the upper left corner of the printing area. This is helpful when you need to lay out your text accurately.

When you've finished marking limit lines, return to the menu/help screen and press the T key. You'll be asked to enter the name of your source file and, optionally, leftover filenames for the text.

After these have been entered, the source file will be opened, and a second menu/help screen will be displayed. Press a key and move to the layout screen as before. Position the cursor where the first character is to be placed and press the T key. (Don't place the cursor directly on a dashed line.) Text will fill down the area marked, following the leftmost limit until no open spaces are detected beneath the line last placed.

Text characters are marked with dots on the layout screen page. Move the cursor and fill any open areas desired. Note that text will only fill downward from the starting point, since that's the way text is read. (If you want an open area in the middle of the page, divide the page into two or more columns to give each area of text a leftmost limit to follow.)

You can start a new source file from the menu/help screen by pressing the F key. The leftover file (if any) will be saved, and the new filename will be entered as before.

To print or save your page, press the S key at the menu/help screen. The source file will be closed and the leftover file saved before a third menu screen appears. From this menu you can print the page or save the formatted page to disk. The saved disk file may be loaded into your word processor for enhancements or printing. Adjust the printer OPEN statement in Line 550 to match the secondary address for your printer. Also note the REM satement in line 540 that provides for carriage returns to be added at the end of each line should your printer require them.

TEXT FITTER

PM 10 REM COPYRIGHT 1990, COMPUTE PUBLICATIONS INT'L, {SPACE}LTD. ALL RIGHTS RESERVED.
AP 20 POKE55,192 : POKE56, 91
PM 30 IFA = 0 THEN A=1 : LOAD"FITTER.ML", 8, 1
PX 40 SYS49252 : REM INIT
MA 50 POKE53280, 0 : POKE53281, 0
RJ 60 PRINT"{CLR}(7)TEXT FITTER - MARK TEXT LIMIT LINES {CYN}"
EE 70 PRINT"{2 DOWN}SELECT CURSOR: [R] = RED [G] = GREEN"
RH 80 PRINT"{DOWN} MOVE SELECTED CURSOR WITH [CRSR] KEYS"
SH 90 PRINT"{DOWN}[M] = MARK LINE BETWEEN CURSORS"
GA 100 PRINT"{DOWN}[U] = UNMARK {SPACE}LINE"
AH 110 PRINT"{DOWN}[CLR] = REMOVE ALL LINES"
GD 120 PRINT"{DOWN}[<] = RETURN {SPACE} TO THIS SCREEN"
HB 130 PRINT"{2 DOWN}(8) PRESS {SPACE}[T] AT THIS SCREEN TO BEGIN"
AQ 140 PRINT"{DOWN} PLACING TEXT. (6) PRESS ANY OTHER KEY TO"
HP 150 PRINT"{DOWN} CONTINUE MARKING LINES."
RM 160 GETK$:IFK$ = "" THEN 160
KP 170 IFK$="T" THEN 200
DG 180 SYS50450 : REM MARKL
KA 190 GOTO 160
GR 200 PRINT"{CLR}[7] TEXT FITTER - PLACE TEXT{CYN}"
QB 210 PRINT"{DOWN} INSERT DISK AND ENTER FILENAME"
XH 220 PRINT"(PRESS [RETURN] ALONE TO GO BACK.)"
SG 230 SF$="" : INPUTSF$ : IFSF$="" THEN60
JF 240 PRINT"{DOWN} ENTER FILENAME FOR LEFTOVER TEXT"
DH 250 PRINT"(PRESS [RETURN] ALONE FOR NO FILE.)"
JA 260 LF$="" : INPUTLF$
QR 270 OPEN2, 8, 2,"0:"+SF$+", S, R"
GP 280 PRINT"{CLR}[7] TEXT FITTER - PLACE TEXT{CYN}"
EF 290 PRINT"{DOWN} MOVE CURSOR WITH [CRSR] KEYS"
QH 300 PRINT"{DOWN}[T] = FILL WITH TEXT AT CURSOR LOCATION"
HG 310 PRINT"{DOWN}[<] = RETURN {SPACE} TO THIS SCREEN."
XD 320 PRINT"{2 DOWN}[8] PRESS {SPACE}[S] AT THIS SCREEN TO SAVE OR"
EQ 330 PRINT"{DOWN} PRINT THE PAGE, [F] TO START A NEW"
SR 340 PRINT"{DOWN}SOURCE FILE. [6] PRESS ANY OTHER KEY TO"
HD 350 PRINT"{DOWN} CONTINUE PLACING TEXT."
AM 360 GETK$:IFK$="" THEN 360
AA 370 IFKS="S"ORKS="F"THEN 420
CE 380 SYS50683 : IFPEEK(49249)= 0 THEN 360 : REM MARKTX, SAVEST
RP 390 CLOSE2 : PRINT"{CLR}END 0F";SF$ : PRINT"{DOWN}PRESS ANY KEY"
SQ 400 GETK$:IFK$=""THEN400
GM 410 GOTO200
PB 420 IFLF$<>"" THEN OPEN3, 8, 3, "0:"+LF$+",S, W" : SYS5115 3 : CLOSE3 : REM LFTOVR
EG 430 CLOSE2
KD 440 IFK$="F"THEN 200
HD 450 PRINT"{CLR}[7] TEXT FITTER -SAVE/PRINT{CYN}"
BF 460 PRINT"{DOWN}[D] = SAVE TO DISK."
BD 470 PRINT"{DOWN}[P]=PRINT (BE SURE PRINTER IS READ Y)."
AJ 480 PRINT"{DOWN}[X]=EXIT."
AB 490 GETK$ : IFK$<>"D"THEN 530
FA 500 INPUT"FILENAME";SF$
DM 510 OPEN2, 8, 2,"0:"+SFS+", S, W"
AJ 520 SYS 51098 : CLOSE 2 : GOTO450 : REM OUTPGE
KQ 530 IFK$O"P"THEN 560
SM 540 REM POKE 51133, 13 : REM TO ADD RETURN TO EACH LINE
FC 550 OPEN2, 4, 7 : SYS51098 : PRINT#2 : CLOSE2 : GOTO4 50 : REM {SPACE} OUTPGE
HM 560 IFK$O"X" THEN 490
JK 570 END