NSFont to CGFontRef
NSFont to CGFontRef
- Subject: NSFont to CGFontRef
- From: Andy O'Meara <email@hidden>
- Date: Tue, 2 Feb 2010 11:26:52 -0600
Hi everyone,
Given an NSFont object how can I extract or create a CGFontRef from it to use directly with CoreGraphics?
I've already searched around in the lists and ADC with no luck.
So far, I've tried the following:
NSFontManager* fm = [NSFontManager sharedFontManager];
NSFont* font = [ fm fontWithFamily:... ];
CFDictionaryRef dict = CFDictionaryCreate( kCFAllocatorDefault, NULL, NULL, 0, NULL, NULL );
CGFontRef fontRef = CGFontCreateCopyWithVariations( (CGFontRef) font, dict );
CFRelease( dict );
int unitsPerEM = CGFontGetUnitsPerEm( fontRef ); // CRASH!
Thanks in advance!
Andy_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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