Microsoft KB Archive/36027

= How to Make PostScript Escape Font for QuickBASIC Application =

Article ID: 36027

Article Last Modified on 11/18/2003

-

APPLIES TO


 * 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



SUMMARY
To send PostScript commands to a PostScript printer (such as the Apple LaserWriter), either you must have a font named &quot;PostScript Escape&quot; on your system or in your application, or you must change the &quot;STR ID -8188&quot; 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.



MORE INFORMATION
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 &quot;apl&quot; file. From the desktop, launch ResEdit. Open your &quot;apl&quot; 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 &quot;PostScript Escape,&quot; you can skip Step 2 below.</li> Copy the file (i.e., select Copy from the Edit menu).</li> Click your application window and select Paste (from the File menu).</li> Open FONT (from the original application or system).</li> Select the smallest point size of the font name that you selected in Step f and Copy it.</li> Click your application window and select Paste.</li></ol> </li> To change the new font to &quot;PostScript Escape&quot;, do the following:

<ol style="list-style-type: lower-alpha;"> Open FOND (from your application).</li> Select the font that you copied and select Get Info from the File menu.</li> Change the name to &quot;PostScript Escape&quot;.</li> Change the ID number to 160.</li> Close the window.</li> Close the FONDs window.</li> Open FONT (from your application).</li> Select the font that you copied, and do a Get Info.</li> Change the ID number to 20480 plus the font's point size.</li> <li>Close the window.</li> <li>Close the FONT's window.</li> <li>Close your application (click &quot;Yes&quot; to save).</li> <li>Quit ResEdit.</li></ol> </li></ol>

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
OPEN &quot;LPT1:&quot; FOR OUTPUT AS #1 WINDOW OUTPUT #1 PRINT &quot;This should have a box around it.&quot; Textfont 160 DrawText &quot;initclip clippath  stroke&quot; 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 &quot;TOOLLIB&quot; ' ' However, this LIBRARY statement is not needed for QuickBASIC programs.

Additional query words: BasicCom MQuickB

Keywords: KB36027

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.