Microsoft KB Archive/35875

= How to Obtain Names and Sizes of All Current Macintosh Fonts =

Article ID: 35875

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Interpreter 3.0 for Macintosh

-



This article was previously published under Q35875



SUMMARY
The program below shows how to list the names and sizes of all the fonts that are available in the current Macintosh System file. Note that you can add, remove, or also list the fonts in the System file by using Apple's &quot;Font/DA Mover&quot; program. Additional fonts are provided in files on Apple Macintosh System software disks.



MORE INFORMATION
Microsoft BASIC and QuickBASIC for the Macintosh can access the fonts that are available in the System file by calling the TEXTFONT ROM routine. PRINT statements will use the font number last specified by the TEXTFONT routine as in the following example: TEXTFONT 4 : TEXTSIZE 9 : PRINT &quot;This is Monaco font.&quot; Apple Computer, Inc., has assigned numbers to all standard Macintosh fonts. Please refer to Page I-219 of &quot;Inside Macintosh&quot; Volume 1 (Addison-Wesley Publishing, 1985) for a list of fonts and their assigned numbers. For a complete list of fonts, you may contact Macintosh Technical Support at the following address:

Macintosh Technical Support

Mail Stop 3-T

Apple Computer, Inc.

20520 Mariani Ave.

Cupertino, CA 95014

The following is a code example that displays the current System fonts: ' Show Fonts. ' This program indexes through all the FOND (FONT Description) resources ' which are installed in the current Macintosh System file, showing the ' name, family id, and unscaled sizes. This program runs as is in ' Macintosh QuickBASIC. To run in the earlier BASIC Compiler Version ' 1.00 or Interpreter Version 3.00, you will need to open the ToolLib ' library as follows: ' LIBRARY &quot;BASIC TOOLBOX:TOOLLIB&quot; DIM c%,h,t$,real%,id%,fontn$ Countres &quot;FOND&quot;,c%  ' Count the number of FOND resources in System. FOR i% = 1 TO c% '   Get font information: GetIndRes &quot;FOND&quot;,i%,h GetResInfo h,id%,t$,fontn$ ReleaseRes h MOVETO 5,WINDOW(5)+20     'line spacing independent of font TEXTFONT id% PRINT &quot;Font &quot;;fontn$;&quot; id&quot;;id%;&quot;Size&quot;; '  Find all unscaled sizes of this font: FOR j% = 1 TO 128 RealFont id%,j%,real% IF real% THEN PRINT i%; NEXT NEXT WHILE MOUSE(0)<>1:WEND   'wait for mouse click to end The following QuickBASIC program also displays all the fonts, in their native (nonscaled) sizes, which are available in the current Macintosh System file. This program is not as simple as the above program, but it is provided as an example of using QuickBASIC's ToolBox routine, which is not found in the earlier BASIC Interpreter Version 3.00 or BASIC Compiler Version 1.00: real% = 0 n$=&quot;&quot; FontName%=&HA8FF ToolBox &quot;I&quot; last%=0 maxSize%=24 maxFnum%=30000 WINDOW 1,&quot;Real Fonts&quot;,,1 TEXTFONT 0:TEXTSIZE 12 PRINT USING &quot;TEXTFONT####] &quot;;i%; FOR i%=0 TO maxFnum% FOR j%=maxSize% TO 5 STEP -1 realFont i%,j%,real% IF real% THEN ToolBox &quot;P&quot;,FontName%,(i%),n$ TEXTFONT i%             IF last%<>i% THEN last%=i% TEXTSIZE maxSize% PRINT TEXTSIZE 12 :PRINT USING &quot;TEXTFONT####] &quot;;i%; END IF             TEXTSIZE j%              PRINT n$;J%; IF WINDOW(4) > WINDOW(2)-150 THEN PRINT END IF    NEXT NEXT WHILE MOUSE(0)<>1:WEND   ' Waits for mouse click to end.

Additional query words: BasicCom MQuickB

Keywords: KB35875

-

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

© Microsoft Corporation. All rights reserved.