Bruno
Bruno

Reputation: 87

How do you change the font of an NSTextView without changing the current content?

Everytime I use -setFont: or -setFont:Range: on my NSTextView, it does change the font, but it shouldn't. I just want to change the font the user is typing with.

For example, if the user types 'hi' it uses the default Helvetica font. When I change the font to Times New Roman it changes that 'hi' into Times New Roman. I don't want that. I just want that, from now on, when the user types, Times New Roman is used instead of Helvetica.

Upvotes: 1

Views: 792

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185661

I think you might want to use -[NSTextView setTypingAttributes:] instead. You should also make sure your text view is set as rich text.

Upvotes: 3

Related Questions