Accessing Fonts 'activated' via ATS calls?
Accessing Fonts 'activated' via ATS calls?
- Subject: Accessing Fonts 'activated' via ATS calls?
- From: Marcel Weiher <email@hidden>
- Date: Sun, 8 Jul 2001 16:29:29 +0200
Hi folks,
I am trying to define some Type 1 fonts during execution of my
application, for use by that application at that time (not for generally
installing this font). The code I am trying to do this with looks as
follows:
+(void)defineFont:(NSData*)fontData
{
OSStatus status;
ATSFontContainerRef fontRef=0;
status = ATSFontActivateFromMemory( [fontData bytes], [fontData
length],
kATSFontContextGlobal,kATSFontFormatUnspecified,NULL,kATSOptionFlagsDefault,
&fontRef );
NSLog(@"defined a font, status: %d, fontRef: %d",status,fontRef);
}
Calling this with a Type 1 font in NSData yields a 0 exit code and some
integer value in the fontRef, so I am assuming that the call succeeded.
However, when I then try to access this font by name (via CoreGraphics
or AppKit) I still get Courier subsituted.
Any ideas wether this should work, or should I be doing something
different? One thing that puzzles me is that there doesn't seem to be
any other API that makes use of an ATSFontContainerRef. Hmm.
Marcel