Re: Where to enforce paragraph-cohesion policy in text system?
Re: Where to enforce paragraph-cohesion policy in text system?
- Subject: Re: Where to enforce paragraph-cohesion policy in text system?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 18 Feb 2008 10:55:46 -0800
On Feb 17, 2008, at 5:03 PM, Daniel Jalkut wrote:
I'm trying to figure out the most appropriate place to impose this
kind of policy. I'm intrigued by NSTypesetter because it seems to be
where the action of determining line fragment rectangles happens.
Should I be subclassing NSTypesetter and somehow causing it to avoid
seeking to fill a container with line fragments, if it won't succeed
in filling an entire paragraph?
NSTypesetter would be the appropriate place for this sort of policy,
since it is responsible for actually laying out the lines of text.
Bear in mind, though, that the typesetter won't know that a paragraph
doesn't fit until it has laid out some of the lines and discovered
that it has run out of space before the end of the paragraph.
NSTypesetter gets called to layout a paragraph at once, and then
queries the text container for each individual line; probably what you
would need to do would be to subclass NSTypesetter and at some point
detect that condition, then set some flag indicating that the
paragraph should be moved to the next container, and restart layout
from the beginning of the paragraph. I'm not sure offhand exactly
where the right override points in NSTypesetter would be.
The suggestion of using tables/blocks is also a reasonable one, but
it's not a complete solution to the keep-together issue because the
editing behavior of table cells/blocks is somewhat different from that
of ordinary paragraphs. If you're dealing with non-editable text this
might be a good solution, but for freely editable text I would tend to
look at a typesetter-based solution.
Douglas Davidson
_______________________________________________
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