FROM : Glen Simmons
DATE : Mon Nov 22 21:39:54 2004
Sorry, I didn't explain myself sufficiently. I need for other apps to
be able to access the font, so I do actually need to get the font into
the proper place. So, I'm still looking for insights on what happens if
my app copies the font into the Fonts folder. i.e. would a logout/login
be necessary? What about permissions? etc.
Would this code allow my app to load and use the font without having to
relaunch or logout/login?
Thanks,
Glen
On 22 Nov, 2004, at 2:21 PM, John Stiles wrote:
> You can load the font in code when you app starts up, without
> installing it anywhere. Just keep it in your bundle.
> Here's some code, copy-and-pasted from my app.
>
> ATSFontContainerRef container;
> OSStatus err = ATSFontActivateFromMemory(
> data.Ptr<void>(),
> data.Size(),
> kATSFontContextLocal,
> kATSFontFormatUnspecified,
> NULL,
> kATSOptionFlagsDefault,
> &container );
>
> if( err != noErr )
> return NULL;
>
> ATSFontRef fontRefs[100];
> ItemCount fontCount;
> err = ATSFontFindFromContainer(
> container,
> kATSOptionFlagsDefault,
> arrsize(fontRefs),
> fontRefs,
> &fontCount );
>
> if( err != noErr || fontCount < 1 )
> return NULL;
>
> NSString *fontName;
> err = ATSFontGetPostScriptName(
> fontRefs[0],
> kATSOptionFlagsDefault,
> reinterpret_cast<CFStringRef*>( &fontName ) );
> // now you can use [NSFont fontWithName:fontName size:size];
>
>
> On Nov 22, 2004, at 11:49 AM, Glen Simmons wrote:
>
>> I need to install a font for one of the features of my app to work.
>> I'd really like to avoid building an installer just to put this one
>> file in the Fonts folder. Can this be done programmatically in a
>> safe, clean way? I'm concerned about permissions, availability to
>> apps, location (~/Fonts vs /Fonts), etc. Any insights would be most
>> appreciated.
>>
>> Thanks,
>> Glen Simmons
>>
>> Opportunity is missed by most because it is dressed in overalls and
>> looks like work. -- Thomas Alva Edison
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/
>> <email_removed>
>>
>> This email sent to <email_removed>
>
DATE : Mon Nov 22 21:39:54 2004
Sorry, I didn't explain myself sufficiently. I need for other apps to
be able to access the font, so I do actually need to get the font into
the proper place. So, I'm still looking for insights on what happens if
my app copies the font into the Fonts folder. i.e. would a logout/login
be necessary? What about permissions? etc.
Would this code allow my app to load and use the font without having to
relaunch or logout/login?
Thanks,
Glen
On 22 Nov, 2004, at 2:21 PM, John Stiles wrote:
> You can load the font in code when you app starts up, without
> installing it anywhere. Just keep it in your bundle.
> Here's some code, copy-and-pasted from my app.
>
> ATSFontContainerRef container;
> OSStatus err = ATSFontActivateFromMemory(
> data.Ptr<void>(),
> data.Size(),
> kATSFontContextLocal,
> kATSFontFormatUnspecified,
> NULL,
> kATSOptionFlagsDefault,
> &container );
>
> if( err != noErr )
> return NULL;
>
> ATSFontRef fontRefs[100];
> ItemCount fontCount;
> err = ATSFontFindFromContainer(
> container,
> kATSOptionFlagsDefault,
> arrsize(fontRefs),
> fontRefs,
> &fontCount );
>
> if( err != noErr || fontCount < 1 )
> return NULL;
>
> NSString *fontName;
> err = ATSFontGetPostScriptName(
> fontRefs[0],
> kATSOptionFlagsDefault,
> reinterpret_cast<CFStringRef*>( &fontName ) );
> // now you can use [NSFont fontWithName:fontName size:size];
>
>
> On Nov 22, 2004, at 11:49 AM, Glen Simmons wrote:
>
>> I need to install a font for one of the features of my app to work.
>> I'd really like to avoid building an installer just to put this one
>> file in the Fonts folder. Can this be done programmatically in a
>> safe, clean way? I'm concerned about permissions, availability to
>> apps, location (~/Fonts vs /Fonts), etc. Any insights would be most
>> appreciated.
>>
>> Thanks,
>> Glen Simmons
>>
>> Opportunity is missed by most because it is dressed in overalls and
>> looks like work. -- Thomas Alva Edison
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/
>> <email_removed>
>>
>> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Glen Simmons | Nov 22, 20:49 | |
| John Stiles | Nov 22, 21:21 | |
| Glen Simmons | Nov 22, 21:39 | |
| John C. Randolph | Nov 22, 22:33 | |
| John Stiles | Nov 22, 23:07 |






Cocoa mail archive

