Re: Using a font without installing it
Re: Using a font without installing it
- Subject: Re: Using a font without installing it
- From: Stefan Landvogt <email@hidden>
- Date: Sun, 16 Jan 2005 09:43:09 +0100
Shauns code that loads all fonts in a certain directory. Call this
method in your AppDelegate...
Be aware, that fonts have also copyright, before you distribute them
with your application.
I learned by the hard way, that Myriad Web Bold is not public domain...
- (void)loadLocalFonts {
NSString *fontsFolder = [[NSBundle mainBundle] resourcePath]; //[
stringByAppendingPathComponent:@"Fonts"];
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;
}
}
}
}
On 16. Jan 2005, at 06:07, Shaun Wexler wrote:
On Jan 15, 2005, at 8:47 PM, Andy Lee wrote:
If the app crashes, will you be left with an installed font that you
didn't want to be there?
The font is private and stored in the app's own memory space, by
default and/or if you specify kFMLocalActivationContext.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden