Re: Font menu in an NSPopUpButton
Re: Font menu in an NSPopUpButton
- Subject: Re: Font menu in an NSPopUpButton
- From: Darrin Cardani <email@hidden>
- Date: Fri, 17 Oct 2003 09:06:12 -0500
I had asked:
I want an NSPopUpButton that contains a list of fonts. What's the
recommended way to do that?
At 6:41 PM -0500 10/16/03, Chris Hanson wrote:
You should be able to set the menu of your popup button to use the
result of -[NSFontManager fontMenu:].
I should have been more clear. The above will give you the font menu
which has commands in it, such as the one to bring up the font
palette, and commands for changing kerning, ligatures, letters, etc.
What I wanted was a list of font families. Dustin's suggestion gives
that:
At 4:54 PM -0700 10/16/03, Dustin Voss wrote:
Programmatically. Here's how I do it in one of my apps:
// Populate font pop-up.
fontList = [[NSMutableArray alloc]
initWithArray:[[NSFontManager sharedFontManager]
availableFontFamilies]];
[fontList sortUsingSelector:@selector(caseInsensitiveCompare:)];
[fontListPopup removeAllItems];
[fontListPopup addItemsWithTitles: fontList];
[fontList release];
Thanks!
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<
http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.