Microsoft KB Archive/36027
Article ID: 36027
Article Last Modified on 11/18/2003
- Microsoft QuickBasic Compiler for Macintosh 1.0
- Microsoft BASIC Interpreter 1.0
- Microsoft BASIC Interpreter 3.0 for Macintosh
This article was previously published under Q36027
To send PostScript commands to a PostScript printer (such as the Apple LaserWriter), either you must have a font named "PostScript Escape" on your system or in your application, or you must change the "STR ID -8188" of the LaserWriter driver to a font that exists either in your application or in the system. Because the latter would require every user of your application to change his or her LaserWriter driver, it is advantageous to install a PostScript Escape font in your application, as described below.
This information applies to Microsoft QuickBASIC Version 1.00 and the Microsoft BASIC Compiler Version 1.00 for Apple Macintosh.
You may also install the PostScript Escape font into your System file for use with programs run in the Microsoft BASIC Interpreter Version 3.00 for Apple Macintosh.
Note: Rather than defining a PostScript Escape font, an easier alternative to send PostScript to the LaserWriter from QuickBASIC (but not earlier BASICs) is described in a separate article found by querying on the keyword PicComment.
Perform the following steps to use ResEdit to install a PostScript Escape font in your Macintosh QuickBASIC compiled application:
- To create a font in your application, do the following:
- Compile your QuickBASIC program to an "apl" file.
- From the desktop, launch ResEdit.
- Open your "apl" application and set the window aside.
- Open another application, the SYSTEM file from the startup disk or any file with fonts installed in it.
- From the new window, open FOND. (FOND is a resource that contains a description of a family of fonts. A family of a given name, such as Geneva, contains family members, each of which are the different sizes of that font.)
- Select a font. To keep the size of your application down, it is a good idea to select a font that has the smallest point size, e.g. Geneva 9. Here, only the names of the fonts are shown -- to determine which font has the smallest point size, open FONT first. (FONT is a resource containing the actual image data for a font.) Note: If the PostScript Escape font exists in another application, select that font. Then, since the font is already named "PostScript Escape," you can skip Step 2 below.
- Copy the file (i.e., select Copy from the Edit menu).
- Click your application window and select Paste (from the File menu).
- Open FONT (from the original application or system).
- Select the smallest point size of the font name that you selected in Step f and Copy it.
- Click your application window and select Paste.
- To change the new font to "PostScript Escape", do the following:
- Open FOND (from your application).
- Select the font that you copied and select Get Info from the File menu.
- Change the name to "PostScript Escape".
- Change the ID number to 160.
- Close the window.
- Close the FONDs window.
- Open FONT (from your application).
- Select the font that you copied, and do a Get Info.
- Change the ID number to 20480 plus the font's point size.
- Close the window.
- Close the FONT's window.
- Close your application (click "Yes" to save).
- Quit ResEdit.
Your application should use TEXTFONT 160 to access the new PostScript Escape font. If a FOND family number 160 already exists in your application, change the ID number to another number. The FOND ID number can range from 0 to 255, and the FONT ID number is found by multiplying the FOND ID number by 128 and adding the font size.
OPEN "LPT1:" FOR OUTPUT AS #1 WINDOW OUTPUT #1 PRINT "This should have a box around it." Textfont 160 DrawText "initclip clippath stroke" CLOSE #1 ' Note that you cannot use PRINT to send the PostScript commands. ' DrawText or DrawString MUST be used, since this method sends the ' entire string at once, whereas PRINT sends the characters one at ' a time, which results in a PostScript error. ' For the BASIC interpreter Version 3.00 and BASIC compiler Version ' 1.00, you need to add the following LIBRARY statement at the top of ' the program to access the DrawText or DrawString routine: ' ' LIBRARY "TOOLLIB" ' ' However, this LIBRARY statement is not needed for QuickBASIC programs.
Additional query words: BasicCom MQuickB