Reputation: 511
I have a font family popup button which lets the user select a font. I also have corresponding font face popup button and a font size combo button in my UI. When a user changes the font family, I want to update the font face popup button's menu with the supported faces/traits for that font family. Could someone please let me know how this is done.
TextEdit seems to do it and I could not figure out how. I have attached a screenshot of the textedit toolbar font popups. I want to mimic these controls in my app.
Upvotes: 2
Views: 435
Reputation: 43472
Use -[[NSFontManager sharedFontManager] availableMembersOfFontFamily:]
to get an array of font descriptions (not instances of NSFont
) in the specified font family. If you have a font already and want its font family, use -[NSFont fontFamily]
.
For the specific format of the returned array, see the documentation for NSFontManager
.
Upvotes: 4