• 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: Setting the Line Height/ Line Spacing in an NSTextView.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the Line Height/ Line Spacing in an NSTextView.


  • Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.
  • From: "Paul Sanders" <email@hidden>
  • Date: Sat, 2 Jan 2010 11:04:52 -0000

Well, I have to say Graham has a point there, and I'm not going
to write your code for you, but what I do goes something like
this:

1.  Get the current typing attributes from my NSTextView (as an
NSDictionary)

2.  Make a mutable copy (as an NSMutableDictionary)

3.  Retrieve the current NSParagrahpStyle from the dictionary
(using NSParagraphStyleAttributeName as a key)

4.  Make a mutable copy of that (as an NSMutableParagraphStyle)

5.  Adjust this as desired (refer to docs)

6.  Add it to the NSMutableDictionary (again with key
NSParagraphStyleAttributeName)

7.  Pass the dictionary to NSTextView's setTypingAttributes
method

8.  Release your mutable copies

You can do something similar (using NSFont and
NSFontAttributeName) if you want to change the font (which might
be what you're after, I'm not sure).

If none of this makes any sense to you, you need to do some
background reading (it's not something you can do in 5 minutes)
and then write youself a little test program.  Mine is called
Cocoa Testbench, and it taught me a lot.

As an aside, I remember when I first started learning Cocoa how
tiring I found it, mentally (I am not the youngest of spring
chickens).  There is a lot to know.  I think it's Hillegass who
recommends getting plenty of sleep.  His book "Cocoa Programming
for Mac OS X" might be worth buying (that will be $5 please
Aaron :).

Paul Sanders

----- Original Message -----
From: "Graham Cox" <email@hidden>
To: "Joshua Garnham" <email@hidden>
Cc: "Cocoa-Dev List" <email@hidden>
Sent: Saturday, January 02, 2010 10:13 AM
Subject: Re: Setting the Line Height/ Line Spacing in an
NSTextView.



On 02/01/2010, at 6:57 PM, Joshua Garnham wrote:

> How would I use that?


RTFM:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.pdf

--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



_______________________________________________

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

  • Follow-Ups:
    • Re: Setting the Line Height/ Line Spacing in an NSTextView.
      • From: Joshua Garnham <email@hidden>
    • Re: Setting the Line Height/ Line Spacing in an NSTextView.
      • From: Andy Lee <email@hidden>
References: 
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: Joshua Garnham <email@hidden>)
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: Graham Cox <email@hidden>)
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: Joshua Garnham <email@hidden>)
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: "Paul Sanders" <email@hidden>)
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: Joshua Garnham <email@hidden>)
 >Re: Setting the Line Height/ Line Spacing in an NSTextView. (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSBezierPath linewidth not correct
  • Next by Date: Re: Custom NSWindow drawing
  • Previous by thread: Re: Setting the Line Height/ Line Spacing in an NSTextView.
  • Next by thread: Re: Setting the Line Height/ Line Spacing in an NSTextView.
  • Index(es):
    • Date
    • Thread