Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I hate NSFontManager!

I hate NSFontManager!
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jun 6, 2005, 11:16 AM
 
Sigh... maybe I'm confused about NSFontManager, but I can't get it to do what I want, and it was suppose to be the easiest part of my latest project :( Here's what I'm trying to do:

Code:
NSFontManager *manager = [NSFontManager sharedFontManager]; NSFontPanel *panel = [NSFontPanel sharedFontPanel]; NSModalSession session = [NSApp beginModalSessionForWindow:panel]; for (;;) { if ([NSApp runModalSession:session] != NSRunContinuesResponse || ![panel isVisible]) break; else { NSFont *font = [manager selectedFont]; if(font != nil) { NSLog(@"%@",font); } } } [NSApp endModalSession:session];
I'd just like to know what the user has selected for the font... but my NSLog is never hit (aka the selected font is always nil). After reading the docs, it almost seems like selectedFont only returns programatic changes to the font... which is odd.

Help!
     
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jun 7, 2005, 10:01 AM
 
A wild guess, I seem to remember something similar happening to me not getting messages from NSFontManager. Try setting the window (in your case 'panel' I think) to be the delegate of the NSFontManager instance. I haven't checked the docs so this could turn out to be wrong.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2