Re: Watch for overflow when drawing string to NSView for printing?
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