diff -r 3d3dcc3116d5 -r 8fad19466c59 GraphicsUtils.m --- a/GraphicsUtils.m Wed Apr 02 14:45:33 2008 -0700 +++ b/GraphicsUtils.m Sun Apr 06 19:13:27 2008 -0700 @@ -6,6 +6,8 @@ // #import "GraphicsUtils.h" +#import "FileUtils.h" +#import @implementation NSImage (MYUtilities) @@ -241,3 +243,32 @@ return r; } + + +OSStatus LoadFontsFromBundle( NSBundle *bundle ) +{ + NSString *fontsPath = [[bundle resourcePath] stringByAppendingPathComponent:@"Fonts"]; + if( fontsPath ) + return LoadFontsFromPath(fontsPath); + else + return fnfErr; +} + + +OSStatus LoadFontsFromPath( NSString* path ) +{ + // Tip of the hat to Buddy Kurz! + FSRef fsRef; + OSStatus err = PathToFSRef(path,&fsRef); + if (err==noErr) + err = ATSFontActivateFromFileReference(&fsRef, + kATSFontContextLocal, + kATSFontFormatUnspecified, + NULL, + kATSOptionFlagsDefault, + NULL + ); + if( err ) Warn(@"LoadFontsFromPath: Error %i for %@",err,path); + return err; +} +