On a NSTextView
when setting the font to .monospacedSystemFont
Xcode shows warnings regarding an invalid font. Example:
CoreText note: Client requested name ".SFNSMono-Bold", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]
Set the same font for the NSTextView.typingAttributes
, example:
let textView = NSTextView()
textView.typingAttributes[.font] = NSFont.monospacedSystemFont(ofSize: NSFont.systemFontSize, weight: .regular)
textView.font = .monospacedSystemFont(ofSize: NSFont.systemFontSize, weight: .regular)