Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Braindead stupid method to return a string representing bitmask values in a UIFontDescriptorSymbolicTraits
- (NSString *)stringForTraits:(UIFontDescriptorSymbolicTraits)traits
{
NSMutableString *string = [@"traits:" mutableCopy];
if ( traits & UIFontDescriptorTraitItalic ) { [string appendString:@", UIFontDescriptorTraitItalic"];}
if ( traits & UIFontDescriptorTraitBold ) { [string appendString:@", UIFontDescriptorTraitBold"];}
if ( traits & UIFontDescriptorTraitExpanded ) { [string appendString:@", UIFontDescriptorTraitExpanded"];}
if ( traits & UIFontDescriptorTraitCondensed ) { [string appendString:@", UIFontDescriptorTraitCondensed"];}
if ( traits & UIFontDescriptorTraitMonoSpace ) { [string appendString:@", UIFontDescriptorTraitMonoSpace"];}
if ( traits & UIFontDescriptorTraitVertical ) { [string appendString:@", UIFontDescriptorTraitVertical"];}
if ( traits & UIFontDescriptorTraitUIOptimized ) { [string appendString:@", UIFontDescriptorTraitUIOptimized"];}
if ( traits & UIFontDescriptorTraitTightLeading ) { [string appendString:@", UIFontDescriptorTraitTightLeading"];}
if ( traits & UIFontDescriptorTraitLooseLeading ) { [string appendString:@", UIFontDescriptorTraitLooseLeading"];}
if ( traits & UIFontDescriptorClassMask ) { [string appendString:@", UIFontDescriptorClassMask"];}
if ( traits & UIFontDescriptorClassUnknown ) { [string appendString:@", UIFontDescriptorClassUnknown"];}
if ( traits & UIFontDescriptorClassOldStyleSerifs ) { [string appendString:@", UIFontDescriptorClassOldStyleSerifs"];}
if ( traits & UIFontDescriptorClassTransitionalSerifs ) { [string appendString:@", UIFontDescriptorClassTransitionalSerifs"];}
if ( traits & UIFontDescriptorClassModernSerifs ) { [string appendString:@", UIFontDescriptorClassModernSerifs"];}
if ( traits & UIFontDescriptorClassClarendonSerifs ) { [string appendString:@", UIFontDescriptorClassClarendonSerifs"];}
if ( traits & UIFontDescriptorClassSlabSerifs ) { [string appendString:@", UIFontDescriptorClassSlabSerifs"];}
if ( traits & UIFontDescriptorClassFreeformSerifs ) { [string appendString:@", UIFontDescriptorClassFreeformSerifs"];}
if ( traits & UIFontDescriptorClassSansSerif ) { [string appendString:@", UIFontDescriptorClassSansSerif"];}
if ( traits & UIFontDescriptorClassOrnamentals ) { [string appendString:@", UIFontDescriptorClassOrnamentals"];}
if ( traits & UIFontDescriptorClassScripts ) { [string appendString:@", UIFontDescriptorClassScripts"];}
if ( traits & UIFontDescriptorClassSymbolic ) { [string appendString:@", UIFontDescriptorClassSymbolic"];}
return string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.