On Feb 3, 2012, at 6:13 PM, Pascal Harris wrote:

> I'm trying to load a custom typeface from my application bundle (a TrueType 
> font of my own design).  Hunting around on the web reveals only methods which 
> are deprecated to the extent of not working under OS X Lion (FMActivateFonts):
> 
> #import <QD/Fonts.h>
> 
> -------------------
> 
>    NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];
>    if (fontsFolder) {
>        NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
>        if (fontsURL) {
>            FSRef fsRef;
>            FSSpec fsSpec;
>            (void)CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
>            OSStatus status = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL,
>                                               NULL, &fsSpec, NULL);
>            if (noErr == status) {
>                FMGeneration generationCount = FMGetGeneration();
>                status = FMActivateFonts(&fsSpec, NULL, NULL,
>                                         kFMLocalActivationContext);
>                generationCount = FMGetGeneration() - generationCount;
>                if (generationCount) {
>                    NSLog(@"app - %@ added %u font file%s", name, 
> generationCount,
>                          (generationCount == 1 ? "" : "s"));
>                }
>            }
>        }
>    }
> 
> 
> My question is (I hope) simple.  How does one load fonts from the Application 
> Bundle in Lion?
> 
Does this work for you...?
http://stackoverflow.com/questions/2444717/embed-font-in-a-mac-bundle


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to