Try it. You cannot just force values ββfrom one type to another. If you create a CTFont from the descriptor and size, this seems to give you a valid array, even if you don't include the transformation matrix (parameter nil)
let font = CTFontCreateWithFontDescriptor(descriptor, 0.0, nil) let features: NSArray = CTFontCopyFeatures(font)
Regarding creating a CTFontDescriptor, I would use CTFontDescriptorCreateWithNameAndSize or CTFontDescriptorCreateWithAttributes depending on what you originally gave. The latter takes up a simple NSDictionary, while the former simply uses the name and font size.
To switch from an existing font (name it originalFont ), simply do the following to get the handle:
let font = CTFontCreateWithName(originalFont.fontName as CFStringRef, originalFont.pointSize as CGFloat, nil)
Dylan gattey
source share