[futurebasic] Re: [FB] [FB3] Font Code Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2000 : Group Archive : Group : All Groups

From: "Brian J. Hughes" <BrianHughes@...>
Date: Mon, 8 May 2000 22:03:49 -0700
At 10:40 PM -0400 on 5/8/00, BHEIBERT810@... wrote:


>I have a simple application that gets the font name from a input statement
>and tells the person what the font id number is.  Does anyone know how I can
>find out the font id for all fonts, not just the common ones?
>

In the file "FutureBasic^3:FB Extensions:Compiler:Headers:Tlbx 
Standard.Incl" there are two ToolBox functions you'll want to use:

GetFNum(@Str255,@short)

GetFontName(short,@Str255)

I think these will only be valid for fonts present on the system it's 
run on.  Certain fonts are hard coded and there are ranges of font 
IDs that are reserved.

You'll want to look at Inside Mac: Text (Font Manager)
<http://developer.apple.com/techpubs/mac/Text/Text-181.html>
and
<http://developer.apple.com/techpubs/mac/Text/Text-190.html>
for information.

This gets the font ID for Geneva only and font names for all the 
fonts from id zero to 23:

// run in console
DIM fontName$, fontid as short
fontName$ = "Geneva"
CALL GETFNUM(@fontName$,@fontid)
PRINT "Font Name","Font Number"
PRINT fontName$,fontid

PRINT
PRINT "Get Font Names"
PRINT

FOR fontid = 0 TO 23                              'all hard coded font IDs
   CALL GETFONTNAME(fontid,@fontName$)
   LONG IF fontName$ <> ""
     PRINT fontName$,fontid
   END IF
NEXT fontid

Brian Hughes