• 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: How can I customize the two lines with different font and size programatically in NStextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I customize the two lines with different font and size programatically in NStextView


  • Subject: Re: How can I customize the two lines with different font and size programatically in NStextView
  • From: Michael Clark <email@hidden>
  • Date: Tue, 30 Aug 2005 22:14:40 -0400

Hi.

You want to take a look at NSAttributedString. You basically want to add different attributes to different ranges within the attributed string.
For example, you would add the bolded, larger font (NOTE: both the size and style can be achieved by dealing only with a font, on attribute on the string: NSFontAttributeName, defined in AppKit/ NSAttributedString.h) attribute around the range that contains your first line (which you could determine by looking for the first newline), then add a different font attribute around the rest of your text.
NSMutableAttributedString has a setAttributes:range: method you would use. Note that NSTextStorage is a subclass of NSMutableAttributedString, and you can get to the text storage by asking your NSTextView for it.


I hope this helps, NSAttributedString is quite the topic to brush over like this, but I hope I understood what you were looking for and gave you a pointer! ;)
Also, check out this page:
http://developer.apple.com/documentation/Cocoa/Conceptual/ AttributedStrings/index.html


Hope this helps,
Michael.

On 30-Aug-05, at 7:02 AM, Sumit Chaudhary wrote:



HI

I have to a problem regarding NSTextView. I wish to print the first line


In the NstextView in Bold and larger fonts ,and rest of lines in normal
font,


Where the contents to NSTextView are input by string.

How can I customize the two lines with  different font and size
programatically?







With Regards,

Sumit Chaudhary

Member-Software Development

QuarkCopyDesk(R&D)



Quark Media House (I), Mohali.
email@hidden







CONFIDENTIALITY NOTICE

This e-mail transmission and any documents, files, or previous e-mail
messages appended or attached to it, may contain information that is
confidential or legally privileged. If you are not the intended
recipient, or a person responsible for delivering it to the intended
recipient, you are hereby notified that you must not read this
transmission and that any disclosure, copying, printing, distribution,
or use of the information contained or attached to this transmission is
STRICTLY PROHIBITED. If you have received this transmission in error,
please immediately notify the sender by telephone(+91-172-304 9147) or
return e-mail message (email@hidden
<mailto:email@hidden> ) and delete the original transmission,
its attachments, and any copies without reading or saving in any manner.
Thank you.





<image002.jpg>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40marketcircle.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >How can I customize the two lines with different font and size programatically in NStextView (From: "Sumit Chaudhary" <email@hidden>)

  • Prev by Date: Re: Tableviews like Excel ones
  • Next by Date: Re: Apple crash reports
  • Previous by thread: How can I customize the two lines with different font and size programatically in NStextView
  • Next by thread: NSKeyedArchiver - alternatives for speed improvements?
  • Index(es):
    • Date
    • Thread