• 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
Drawing lines between text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing lines between text


  • Subject: Drawing lines between text
  • From: Keith Blount <email@hidden>
  • Date: Sat, 9 Jul 2005 13:52:34 -0700 (PDT)

Hello,

I feel this should be very simple, so I am probably
overlooking something very obvious, but...

I am drawing an attributed string in a view using
NSAttributedString's drawInRect: method. I would like
to make this view look like lined paper, so I need to
draw lines between each line of text. How can I get
the line height for each line of text drawn to
calculate this?

I have tried calling pointSize on the font, but this
doesn't give the padding. I have also tried using
NSLayoutManager like this:

NSLayoutManager *lm = [[NSLayoutManager alloc] init];
float lineHeight = [lm defaultLineHeightForFont:font];
[lm release];

Neither seem to work right for all fonts, however.

If anyone has any suggestions of how to calculate the
line height for arbitrary fonts when using
NSAttributedString's drawInRect: so that I can figure
out where to draw my lines, I would be very grateful.

Many thanks,
Keith



__________________________________
Discover Yahoo!
Use Yahoo! to plan a weekend, have fun online and more. Check it out!
http://discover.yahoo.com/
 _______________________________________________
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

  • Prev by Date: Re: Documentation frustrations
  • Next by Date: Re: Importance of thread safety and performance.
  • Previous by thread: Re: Seeking advice: which "Design Patterns" book is best
  • Next by thread: Re: Drawing lines between text [SOLVED]
  • Index(es):
    • Date
    • Thread