| Rich Love wrote: | > | > I have not tried the ATSFontActivateFromFileReference method yet. | > Are you saying you think that will not work? | | No, I said that ATSFontFamilyFindFromQuickDrawName() is no good by itself. | Brian found the missing piece: ATSFontActivateFromFileReference(). | Below is Brian's code extended to a full working demo. | | Robert P. just wanted to say thanks to brian and robert - this code enabled me to embed a Type1 font (with its corresponding FFIL screen font) into my app. perhaps it should be included in the next FB_Examples? regards from toronto island. john p // Embed Font Resources // Brian S., and Robert Purves, November 2, 2010 include "Util_FileDirectory.incl" #define ATSFontContext as UInt32 #define ATSFontFormat as UInt32 #define ATSOptionFlags as UInt32 #define ATSFontContainerRef as UInt32 #define ATSFontFamilyRef as UInt32 _kATSFontFormatUnspecified = 0 _kATSOptionFlagsDefault = 0 _kATSFontContextLocal = 2 toolbox fn ATSFontActivateFromFileReference ( const FSRef *iFile, ATSFontContext iContext, ATSFontFormat iFormat, pointer iRefCon, ATSOptionFlags iOptions, ATSFontContainerRef *oContainer) = OSStatus toolbox fn ATSFontFamilyFindFromQuickDrawName( ConstStr255Param iName ) = ATSFontFamilyRef include resources "Fonts" // with file SnellRoundhand.dfont local mode local fn ActivateFontFromResourcesFile( fontFileName as CFStringRef ) '~'1 dim as CFURLRef resourcesCFURL, url dim as FSRef resourcesFSRef,fileRef dim as OSStatus err : err = _dirNFErr resourcesCFURL = fn CFBundleCopyResourcesDirectoryURL( fn CFBundleGetMainBundle ) url = fn CFURLCreateCopyAppendingPathComponent( _kCFAllocatorDefault, resourcesCFURL, @"Fonts", _false ) CFRelease( resourcesCFURL ) long if ( url ) fn CFURLGetFSRef( url, @resourcesFSRef ) CFRelease( url ) err = fn FD_PathGetFSRef( fontFileName, @resourcesFSRef, @fileRef ) if ( err == _noErr ) then err = fn ATSFontActivateFromFileReference( @fileRef, _kATSFontContextLocal, _kATSFontFormatUnspecified, 0, _kATSOptionFlagsDefault, #0 ) end if end fn = err // main dim as ATSFontFamilyRef fNum dim as OSStatus err dim as long n window 1 print : print err = fn ActivateFontFromResourcesFile( @"Cheq Screen" ) // file name if ( err ) then stop "ActivateFontFromResourcesFile error " + str$( err ) fNum = fn ATSFontFamilyFindFromQuickDrawName( "Cheq" ) // font name text fNum, 32// set font for printing to window for n = 0 to 4 print "P L S T Q K" next n HandleEvents