• 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
Re: Font menu in an NSPopUpButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Font menu in an NSPopUpButton (From: Dustin Voss <email@hidden>)

  • Prev by Date: How to get system version?
  • Next by Date: Re: launching 2 same applications
  • Previous by thread: Re: Font menu in an NSPopUpButton
  • Next by thread: Safari's rendezvous feature
  • Index(es):
    • Date
    • Thread