开发者

Setting default fonts in NSTextView

开发者 https://www.devze.com 2022-12-13 10:59 出处:网络
How can I set the default font of an NSTextView comp开发者_如何学JAVAonent? I need to have an area in my app where users can make changes to a plain text file, and I\'d like for the font to be a monos

How can I set the default font of an NSTextView comp开发者_如何学JAVAonent? I need to have an area in my app where users can make changes to a plain text file, and I'd like for the font to be a monospaced font.


Found it. This answer was close, but wouldn't do it - had to access the textStorage object of the NSTextView first:

[[myNSTextView textStorage] setFont:[NSFont fontWithName:@"Menlo" size:11]];


NSFont* font = <whatever>;
[textView setFont: font];
0

精彩评论

暂无评论...
验证码 换一张
取 消