Re: Getting font info
Re: Getting font info
- Subject: Re: Getting font info
- From: Douglas Davidson <email@hidden>
- Date: Fri, 31 May 2002 13:21:33 -0700
On Friday, May 31, 2002, at 12:43 PM, Peter Schols wrote:
I'm looking for the easiest way to know whether a selected piece of
text in an NSTextView is bold or not.
I have tried the following:
Putting the selected text from the textfield in an NSAttributedString:
[as initWithRTF: [textView RTFFromRange:[textView selectedRange]]
documentAttributes:NULL];
That's imaginative, but pretty twisted. What you want is [textView
textStorage]. The text storage is the actual text that the view will
display, stored as an NSTextStorage, which is a subclass of
NSMutableAttributedString. Use any NSAttributedString or
NSMutableAttributedString methods on it. Check the documentation for
more information on this, both the class documentation and the text
system concepts documentation.
Douglas Davidson
_______________________________________________
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.