I am working on getting the HandyUIKit String extensions working with AppKit.
What is the equivalent for
var font : UIFont
font.withSize(font.pointSize * scriptedTextSizeRatio)
in Appkit and NSFont?
var font : NSFont
font.withSize(font.pointSize * scriptedTextSizeRatio)
Here is the code section I am working on:
let capturedSubstring = unprocessedString.attributedSubstring(from: match.range(at: 1)).mutableCopy() as! NSMutableAttributedString
let captureFullRange = NSRange(location: 0, length: capturedSubstring.length)
capturedSubstring.addAttribute(.font, value: font.withSize(font.pointSize * scriptedTextSizeRatio), range: captureFullRange)
NSFontdoesn't seem to have an equivalent methodwithSizelikeUIFont.One solution would be to use:
Note that
newFontwill be optional so check the result as needed.