[futurebasic] Re: [FB] Re: Fonts in osx

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

From: michael evans <michael.evans@...>
Date: Tue, 13 Jan 2004 23:09:58 -0500
Ken

Thanks for the response

Running your test application, I still get geneva 24 output and
fontNum% = -8864....

Latest fb, panther 10.3.2, g4 titanium powerbook


on 1/13/04 10:38 PM, Ken Shmidheiser at kshmidheiser@... wrote:

> Michael asked:
> 
>> 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
>> 
>> //begin code
>> 
>> Can some kind soul tell me how to do this right?
>> 
>> I'm actually trying to do this to a gWorld...
>> But getting this sample to work might give me a clue...
> 
> 
> Michael,
> 
> Perhaps Carbon is biting you. Here are two functions that may be of
> assistance.
> 
> Ken
> 
> p.s. Watch e-mail line breaks and lost constant underscores.
> 
> 
> #If CarbonLib
> 
> Begin Enum
> _kInvalidGeneration =  0
> _kInvalidFontFamily = -1
> _kInvalidFont       =  0
> End Enum
> 
> #Define FMFontFamily As SInt16
> 
> Toolbox Fn FMGetFontFamilyFromName( Str255 iName ) = FMFontFamily
> Toolbox fn FMGetFontFamilyName ( FMFontFamily iFontFamily, Str255
> oName ) = OSStatus
> 
> #Endif
> 
> Local Mode
> Local Fn GetFontNumber( fontName As Str255 )
> #If CarbonLib
> Dim As Int fontNumber
> fontNumber = Fn FMGetFontFamilyFromName( fontName )
> If fontNumber = _kInvalidFontFamily Then fontNumber = 0
> #Else
> Dim As Int @ fontNumber
> GetFNum( fontName, fontNumber )
> #Endif
> 
> End fn = fontNumber
> 
> Local Mode
> Local Fn GetFontName$( fontNumber as int )
> #If CarbonLib
> Dim As Str255   fontNameStr
> Dim As OSStatus stat
> stat = fn FMGetFontFamilyName ( fontNumber, fontNameStr )
> #Else
> Dim As Str255 fontNameStr
> GetFontName( fontNumber, fontNameStr )
> #Endif
> 
> End fn = fontNameStr
> 
> window 1
> 
> print Fn GetFontNumber( "Times" )
> print Fn GetFontName$( 20 )
> 
> include "Subs Quick Event Loop.Incl"
> 

Cheers,

----------------------------------------------------------------------------
Michael Evans
----------------------------------------------------------------------------