Medium or High Resolution
ST Font Printer
by Charles F. Johnson
Charles F. Johnson is a professional musician and, now, a semi-professional computer programmer/reviewer/author. He lives in Los Angeles with his wife Patty, and Spike, the world's most intelligent cat. Charles is a SYSOLP on the ANALOG PUBLISHING Atari SIG on Delphi; his user name is CFJ.
This month ST-Log is proud to present the second-place winner in out ST programming contest. Due to the size of the program, the source listings could not be printed in the magazine. The program (and all associated files) is available on this month's disk version and on the ANALOG Atari SIG on Delphi.
ST Font Printer is a general purpose printing utility that will let you print any ASCII text file (up to 100K in size) to an Epson/Gemini or IBM-compatible printer, using a redefined character set or the default ST system font (the one you see on the screen in low- and medium-resolution color modes). Fonts can be printed in two sizes (single or double width). There is a Type-a-Line feature that lets you enter a line of text from the keyboard and print it with any font, very handy for titles. You can also create professional-looking four-line address labels using common 15/16 by 3½-inch tractor-feed labels, up to 99 at a time (this feature can also be used to address envelopes).
The program allows you to set some of your printer's special features to aid in producing a neatly formatted printout. You can set the left margin and the line spacing, and skip over the perforation on tractor-feed paper. Text files with embedded TABs, such as those produced by the MicroEMACS editor, will print with correct column alignment.
ST Font Printer supports two types of fonts; fonts created by the DEGAS drawing program, or any 8-bit Atari font. The program also allows you to convert fonts from one format to the other. This is a fully GEM-based program written in 68000 assembly language; it will work on any ST with TOS in ROM, in either medium-res color or monochrome modes.
How to use it
To run ST Font Printer, its GEM resource file (STPRINT.RSC) must be in the same directory as the program. Just double-click on STPRINT.PRG and off you go! The "ST FONT PRINTER" window will open, a title box will display, and the top menu bar will show the choices Desk (actually, an Atari logo), Exit, Fonts, Print, and Options. Click on the Continue button in the title box, and it will zoom away; now you can point at any of the menu choices causing a sub-menu to drop down. When you click on a drop-down menu item, the window's information line will show the option you've selected. The window's information line will display all the current print settings and is updated every time you change something with the Set Print Options selection. Here are explanations of the various menus and sub-menus:
ST Font Printer—Click on this selection to re-display the title box (in case you forget the name!).
Quit—Does just what it says, exits to the GEM desktop. You will see a dialog box asking you to confirm your decision. You can also click on the close box in the upper-left corner of the window to exit program.
Load DEGAS Font
Load Atari 8-bit Font—Choose one of the font-loading functions, and an Item Selector box will appear. The default extensions for the different font types are ".FNT" for DEGAS and ".FN8" for 8-bit fonts. The window's title line shows which option you've chosen, as a reminder. To load a font you can either click once on the name of the font, and then click on the OK button, or simply double*click on the name itself; the Cancel button will abort the operation.
If you wish to change the drive or pathname, type an up-arrow to move the cursor to the directory line, and edit the drive and pathnames, but don't press RETURN when you're done. Instead, move the mouse cursor inside the file window and click once. This will show the new directory. (This is an inconsistency in Atari GEM—the IBM version of the Item Selector box will let you press RETURN after editing the directory line.) If you change the directory line, be sure to include a full, legal GEM pathname, such as "A\FONTS\ *.SET" (the backslash "\" after the colon is important). The program remembers the directories for each type of font so you'll only have to do this once. (You may also change the current drive for all file accesses by using the Set Current Drive option; see below.)
When the font is finished loading it will be displayed in a box at the bottom of the screen, and its name will be printed on the right side of the menu bar. Bear in mind that when you first run ST Font Printer, the custom font printing option is disabled and all printing operations will use the ST system 8 by 8 font. To print with a font you've loaded, you must go to the Set Options menu and enable it first (see below).
Write DEGAS Font
Write 8-bit Font—These options let you convert a font from 8-bit to DEGAS format, or vice versa. They are disabled (shown in lighter type) when the program is started; loading a font will enable them. When you choose to write (store on disk) either type of font, the program will present you with the famed Item Selector box once again. The current font filename is used as the default name, with the correct extension (".FNT" or ".FN8") automatically appended to it. If the font name already exists on the disk, you will be given the chance to change your mind or continue and over-write the existing file.
Show User Font—When you first run the program this option is disabled, like the Write functions above. After you load a font file, it will be activated, and it'll display the name of the current font. Clicking on this selection will cause all subsequent drop-down menus and dialog boxes to use the current font for their text; the next time you pull down this menu, it will say Show System Font, to allow you to switch back to the default ST system font. Please note that the font name shown in the window's info line is the one that will be printed, not the one you see on-screen. To set the front to be printed see below, under Set Print Options.
Print File—Choose this and you'll see another Item Selector box; this one displays all files with a ".DOC" extension. Make sure your printer is ready to go, and select the file. Another dialog box will appear to allow you to select options for a title line. You can print the filename, date, and time in a special line of inverse text at the top of your printout, or choose not to print a title line at all. Click on OK—the mouse cursor will change to the "busy bee" and your printer will start chuckling away (actually, my printer sounds more like a screaming banshee). If you want to abort the printout, just press the Undo key.
NOTE: ST Font Printer will display only print straight ASCII text files, with a maximum line length of 120 characters. To print an ST Writer document, you should use the Print option from the main ST Writer menu to print it to a disk file. Since ST Writer prints to disk with full formatting, you'll probably want to set the Skip Perforation feature to OFF. If you use 1st Word on the other hand, save your file with Word Processor mode turned off. This creates a text file with no formatting at all, so the Skip feature comes in very handy here.
Type a Line—Lets you enter a line from the keyboard that'll be printed using the current option settings displayed in the window's information line (see below). After entering the line, you may either use the mouse and click on the OK button, or just press RETURN. This feature can be used to print titles and comments before or after your listings.
Address Labels—Choosing this option brings forth a dialog box resembling a label, with four lines in which to enter text. To move from line to line, don't press RETURN; use the arrow keys to move up and down. You can also set the number of labels to print, in a box at the lower left. Just click on the up or down arrows and the value will change accordingly. The Undo key will abort a printout, just as with the Print File option. IMPORTANT: To correctly align the labels you should set Skip Perforation to NO and set line spacing to 1/6 inch (see Set Options), and use labels that are 15/16 inch high, so it is exactly one inch from the top of one label to the next.
Set Print Options—This lets you set some of the printer's special features. A dialog box will appear with several toggle-able buttons and an editable text field. You may choose to print with small or large (double width) characters, set Skip Over Perforation, choose which font you will print with, initialize the printer after printing a file, choose between several line spacings, or set the left margin wherever you like.
To set the left margin, click on the up or down arrows next to the box. Click and hold the mouse button on the arrows to adjust the value quickly.
If you choose not to initialize the printer, the perforation setting is retained for successive printing operations.
The Options dialog box has a Cancel button that will reset the options to their initial states without exiting the box, in case you should happen to change your mind. When everything is set the way you want it, click on the OK button. Notice that the window's info line changes to reflect any choices you've made.
Set Printer Type—This option lets you choose between two types of printers; a standard Epson or Epson-compatible printer (such as the Gemini 10-X) or an IBM-compatible printer. If you have a Star SG-10, you can enable its IBM mode by turning DIP switch 2-2 off.
Set Current Drive—Lets you select the drive which will be used for all file accesses. Up to 16 drives are supported, so you can use Ramdisks, hard disks, etc.
ST Font Printer is pretty well error-trapped. If an error occurs during a disk operation, you'll see a box containing a description of the error in English (not just something like "TOS error #33!). And if your printer isn't ready (power off, not connected, off-line, etc.) you'll see a box telling you that. If you get an "Insufficient memory" message, re-boot your system without any accessories or Ramdisks installed.
NOTE: Some fonts created with the DEGAS font editor will not look right with ST Font Printer. This is because DEGAS uses an 8 by 16 font matrix, and ST Font Printer expects its fonts to be in an 8 by 8 matrix. Thus, when it loads a DEGAS font, it discards every other byte in the matrix, creating an 8 by 8 grid from an 8 by 16 one. If some of the characters look a little strange, you can edit them with the DEGAS font editor. However, most of the DEGAS fonts I've tried do not need any editing, including the ones that are supplied with the DEGAS package.
If you use the skip-over-perforation feature, I recommend you position the printhead about two line feeds below the perforation before you start printing. This will ensure that each page of text is centered. For address labels, remember to use the settings described above. You'll have to experiment a bit to find the best starting point for label printing.