[futurebasic] Re: [FB] Fonts in osx

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Thu, 15 Jan 2004 00:09:38 +1300
michael evans wrote:

> Hello all...
> This prints geneva 9 instead of sand 24...
>
> //begin code
> clear local
> local fn getFontNumber
> dim fontName$, fontName2$
> dim @ fontNum%
>
> fontName$ = "Sand"
> GETFNUM(fontName$,fontNum%)
> GetFontName(fontNum%,fontName2$)
> TEXT fontNum%,24,0,49
>
> PRINT fontName2$
> end fn
>
> fn getFontNumber
>
> DO
> HANDLEEVENTS
> UNTIL gFBQuit

The FB text statement sets the font for the current port. In your 
example, no port was set at the time of the text statement.  You'll 
need to set up a window first, or do SetGWorld( myGW, 0 ).

local fn GetFontNumber( fontName as Str255 )
dim @ fontNum
GetFNum( fontName, @fontNum )
end fn = fontNum


window 1 // create a window with a port whose text can be set
text fn GetFontNumber( "Sand" ), 24
print %(5,24) "Hello"
do
HandleEvents
until 0


Robert P.