Popup font menu
Popup font menu
- Subject: Popup font menu
- From: John Nairn <email@hidden>
- Date: Thu, 12 Sep 2002 16:58:09 -0600
I would like to add a pop-up menu (tickFont) to set the font of a
feature in a graph. I put the fonts in the menu with
fontList=[ [[NSFontManager sharedFontManager] availableFontFamilies]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[tickFont addItemsWithTitles:fontList];
When a font is selected, it is created with
[NSFont fontWithName:[tickFont titleOfSelectedItem]
size:tickSize];
But many of the names from the "availableFontFamilies" fail to give a
valid font and exceptions often result. Is there a way to get a list of
only valid font names (i.e. name that work with fontWithName) into a
popup menu?
Other things I tried were
1. I added availableFonts instead of availableFontFamilies, but the
resulting menu is too long
2. Screened the fonts prior to the menu creation by trying to create a
font with all menu items and only add those that worked, but this is
too slow.
3. I would rather use the FontPanel, but I did not see an interface
method to connect the settings of the font panel to my settings option
(i.e. a button to set the font or a non-text object)
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.mse.utah.edu/~nairn
_______________________________________________
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.