• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting font info
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Getting font info (From: Peter Schols <email@hidden>)

  • Prev by Date: Re: Socket data incoming event?
  • Next by Date: Re: About sockets...(part III)
  • Previous by thread: Getting font info
  • Next by thread: Re: Getting font info
  • Index(es):
    • Date
    • Thread