• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSFont to CGFontRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSFont to CGFontRef
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: How to upload a picture or movie existed in the iphone to a given server?
  • Next by Date: keyCode translation for various keyboards
  • Previous by thread: Re: Cloning an NSXMLElement and its children?
  • Next by thread: Re: NSFont to CGFontRef
  • Index(es):
    • Date
    • Thread