Microsoft KB Archive/36027

From BetaArchive Wiki
Knowledge Base

How to Make PostScript Escape Font for QuickBASIC Application

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:

  1. To create a font in your application, do the following:

    1. Compile your QuickBASIC program to an "apl" file.
    2. From the desktop, launch ResEdit.
    3. Open your "apl" application and set the window aside.
    4. Open another application, the SYSTEM file from the startup disk or any file with fonts installed in it.
    5. 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.)
    6. 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.
    7. Copy the file (i.e., select Copy from the Edit menu).
    8. Click your application window and select Paste (from the File menu).
    9. Open FONT (from the original application or system).
    10. Select the smallest point size of the font name that you selected in Step f and Copy it.
    11. Click your application window and select Paste.
  2. To change the new font to "PostScript Escape", do the following:

    1. Open FOND (from your application).
    2. Select the font that you copied and select Get Info from the File menu.
    3. Change the name to "PostScript Escape".
    4. Change the ID number to 160.
    5. Close the window.
    6. Close the FONDs window.
    7. Open FONT (from your application).
    8. Select the font that you copied, and do a Get Info.
    9. Change the ID number to 20480 plus the font's point size.
    10. Close the window.
    11. Close the FONT's window.
    12. Close your application (click "Yes" to save).
    13. 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.

Code Example

PRINT "This should have a box around it."
Textfont 160
DrawText "initclip  clippath  stroke"
' 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:
' However, this LIBRARY statement is not needed for QuickBASIC programs.

Additional query words: BasicCom MQuickB

Keywords: KB36027