• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Loading fonts from bundles (again!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading fonts from bundles (again!)


  • Subject: Loading fonts from bundles (again!)
  • From: Michael Norris <email@hidden>
  • Date: Tue, 28 Jan 2003 13:02:47 +1300

Hiya

I'm currently writing an app that draws characters to an NSView
subclass using a font located in the application's main bundle. I'm
using the following code that I found on Mamasam:

NSBundle * appBundle = [NSBundle mainBundle];
NSString * fontsPath = [appBundle pathForResource:myFontName
ofType:@"suit"];
FSRef fsRef;
FSSpec fsSpec;
int osstatus = FSPathMakeRef( [fontsPath UTF8String], &fsRef, NULL);
if ( osstatus == noErr) {

osstatus=FSGetCatalogInfo(&fsRef,kFSCatInfoNone,NULL,NULL,&fsSpec,NULL);
}
osstatus = FMActivateFonts( &fsSpec, NULL, NULL,
kFMLocalActivationContext);


Most of it works fine - the font path is found, the fsSpec is
successfully made.

But FMActivateFonts returns an error code of -39...

According to the Macerrors.h, -39 is an eofErr... Which is just plain
weird. It tends to suggest there's something wrong with the font: but
the font works fine if you plonk it in the Fonts folder.

Something broken in OS X 10.2.3, perhaps? Or, more likely, something
I'm doing wrong?

-mike
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Small font issue
  • Next by Date: Re: NSDrawer delegate function mis-described?
  • Previous by thread: removeObjectsInArray enhancement?
  • Next by thread: Re: Loading fonts from bundles (again!)
  • Index(es):
    • Date
    • Thread