• 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: Watch for overflow when drawing string to NSView for printing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Watch for overflow when drawing string to NSView for printing?


  • Subject: Re: Watch for overflow when drawing string to NSView for printing?
  • From: Fritz Anderson <email@hidden>
  • Date: Mon, 13 Jun 2005 22:27:55 -0500

On 13 Jun 2005, at 9:56 PM, Justin Hawkwood wrote:

I have an NSString that I would like to draw (using drawInRect: withAttributes:?) to an NSView for printing. As this string was entered using a NSTextView, it could be very long, and I want to know if it overflows the rect that I set it to draw in, and if so where in the string it was clipped, so that I can continue the rest of the string on an other page (rinse and repeat).
PLUS how to do this in pre-10.3?

Once you get into measuring text layouts and multiple text containers, you are officially out of the realm of NSString convenience methods, and into NSLayoutManager and NSTextContainer. Stop for a couple of hours and learn the Cocoa text stack.


You want to read: <http://developer.apple.com/documentation/Cocoa/ Conceptual/TextLayout/index.html>.
Possible prerequisite: <http://developer.apple.com/documentation/ Cocoa/Conceptual/TextArchitecture/index.html>


Examples at /Developer/Examples/TextEdit and /Developer/Examples/ TextSizingExample

I'm sorry, but your head will hurt for a little while (technically, it _is_ brain damage...), but it's the only way to do everything you say you want to do.

    -- F

_______________________________________________
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


  • Follow-Ups:
    • layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
      • From: Justin Hawkwood <email@hidden>
References: 
 >Watch for overflow when drawing string to NSView for printing? (From: Justin Hawkwood <email@hidden>)

  • Prev by Date: Re: Cocoa-Java-based Universal Binary?
  • Next by Date: Re: Cocoa-Java-based Universal Binary?
  • Previous by thread: Watch for overflow when drawing string to NSView for printing?
  • Next by thread: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
  • Index(es):
    • Date
    • Thread