I’m using -[NSFontManager availableFontNamesWithTraits:] and I want to get the 
names of all of the fonts that have both a regular (plain) and bold option.

I’ve tried various things, but this seems like it should work:

        NSArray* fonts = [[NSFontManager sharedFontManager] 
availableFontNamesWithTraits:NSBoldFontMask | NSUnboldFontMask];

Except it returns no results. According to the docs if I pass 0 for traits, it 
should return all the plain fonts, and it’s equivalent to NSUnboldFontMask | 
NSUnitalicFontMask. That returns no results.

If I set it to a single value, such as NSBoldFontMask, I get all the bold 
fonts, but no plain ones. I also tried NSBoldFontMask | NSUnboldFontMask | 
NSUnitalicFontMask, but that returns no results.

What’s the magic traits mask I need? Seems like it should be a simple thing to 
get plain + bold, except that a bit mask doesn’t really work to express this, 
because there’s no value for “plain” - plain is the absence of any other trait. 
So how do I ask for it?

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to