Re: Application unique/specific font question
Re: Application unique/specific font question
- Subject: Re: Application unique/specific font question
- From: Buddy Kurz <email@hidden>
- Date: Tue, 23 Jan 2007 21:26:30 -0800
I don't suppose you would care to share the content of that script?
It just so happens I have been try to do the same thing off & on for
the last few days - hadn't hit on the resource fork thing...
On Jan 23, 2007, at 8:10 PM, Matt Neuburg wrote:
On Tue, 23 Jan 2007 15:30:54 -0700, "Marcus S. Zarra"
<email@hidden> said:
Is it possible to load a font from the application bundle rather than
from the font directory?
Something like this (slight simplification of Shaun Wexler's code):
NSURL *fontsURL = [NSURL fileURLWithPath: [[[NSBundle mainBundle]
resourcePath] stringByAppendingPathComponent:@"Fonts"]];
FSRef fsRef;
FSSpec fsSpec;
(void) CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
(void) FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL,
&fsSpec,
NULL);
(void) ATSFontActivateFromFileSpecification
(&fsSpec, kATSFontContextLocal, kATSFontFormatUnspecified,
NULL,
kATSOptionFlagsDefault, &container);
However, do note that by far the biggest problem (in my experience) is
getting the blasted font into the bundle to begin with! If you just
use the
built-in copy files phase, the font file is stripped of its
resource fork,
which, in many cases, is where the information was. So you have to
use a run
script phase instead. Until I figured this out, I couldn't get the
above
code to work (because the font file was no longer a valid font
file). m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden