Reputation: 393
I am able to change the Font in NSTextView AFTER I have loaded some text.
but how can I set this Font as the default Font?
if the user starts typing in an empty NsTextView control, the Font always returns to the controls default Font which seems to be 'Helvetica Regular', size 12
Upvotes: 7
Views: 5424
Reputation: 101
The following works for me
func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application
nameTextView.font = NSFont(name: "Lucida Sans", size: 15)
Upvotes: 10
Reputation: 393
Ok, after a lot of try and error I found a solution:
let font = NSFont(name: "Lucida Sans", size: 18)
let attributes = NSDictionary(object: font!, forKey: NSFontAttributeName)
nameTextView.typingAttributes = attributes
I put that code lines in function awakefromNib
Upvotes: 15