How I can convert a UIFontDescriptorSymbolicTraits
to CTFontSymbolicTraits
?
Look at how they are defined. Here is CTFontSymbolicTraits:
enum {
kCTFontItalicTrait = (1 << 0),
kCTFontBoldTrait = (1 << 1),
kCTFontExpandedTrait = (1 << 5),
kCTFontCondensedTrait = (1 << 6),
// ...
};
typedef uint32_t CTFontSymbolicTraits;
Here is UIFontDescriptorSymbolicTraits:
typedef enum : uint32_t {
UIFontDescriptorTraitItalic = 1u << 0,
UIFontDescriptorTraitBold = 1u << 1,
UIFontDescriptorTraitExpanded = 1u << 5,
UIFontDescriptorTraitCondensed = 1u << 6,
// ...
} UIFontDescriptorSymbolicTraits;
Notice anything? As far as the traits that matter to you are concerned, they are in fact identical. There is nothing to convert.