Re: Problem with setting fonts in NSTextView
Re: Problem with setting fonts in NSTextView
- Subject: Re: Problem with setting fonts in NSTextView
- From: Graham Cox <email@hidden>
- Date: Fri, 9 Jan 2009 22:31:26 +1100
On 9 Jan 2009, at 10:07 pm, rethish wrote:
NSArray *path=[[NSFontManager alloc] availableFonts];
I take it this is merely a typo; you surely mean:
[[NSFontManager sharedFontManager] availableFonts];
Using: [textview setFont:fontobj];
Where fontobj is an object of nsfont.
But the problem is ,if we select any item from the popupbutton ,the
entire
text's font is changed from the textview.
I really want to set font whenever we select an item
This is exactly what the documentation says it will do.
Instead try:
[myTextView setFont:fontObj range:[myTextView
rangeForUserCharacterAttributeChange]];
Bear in mind the comments in the docs for that method regarding undo.
Also, you might need to use:
-setTypingAttributes: to seta font ready for typing when the text or
selection range is empty.
hth,
Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden