Re: Setting NSTextView's Font
Re: Setting NSTextView's Font
- Subject: Re: Setting NSTextView's Font
- From: Ramesh <email@hidden>
- Date: Wed, 31 Mar 2004 15:06:02 +0530
I would like my NSTextView to only use one font, Monaco 10-pt. In the
awakeFromNib method I have:
[[self textStorage] addAttribute:NSFontAttributeName value:[NSFont
fontWithName:@"Monaco" size:10.0] range:NSMakeRange(0, [[[self
textStorage] mutableString] length])];
But this does not work. My first thought was simply to set the font in
the nib itself, but it only works if the field also has text in it,
otherwise it defaults to Helvetica 12.
Is there something I'm missing?
Yes.Its works only if some text already exits. Otherwise the font is
not applied. Because an attribute gets added only if text exits in that
range exists. Since there is not text in the beginning the font does
not apply.
If you want to apply default font , i think use should use setFont: in
NSTextView class.
------------------------------------------------------------------------
--
Ramesh PVK
Programmer
effigent India Pvt. Ltd.
ⅱ Home : 040 27227830
: 040 31148951
------------------------------------------------------------------------
--
In a world without walls and fences, who does still need Windows and
Gates ?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.