NSLayoutManager and pagebreaks redux
NSLayoutManager and pagebreaks redux
- Subject: NSLayoutManager and pagebreaks redux
- From: John Brownlow <email@hidden>
- Date: Wed, 23 Mar 2005 15:11:04 -0500
I asked this before but no joy so am trying again -- any input much
appreciated.
In my screenwriting app there are user-defined paragraph styles rather
like the ones in Pages. As in Pages, I need to be able to control the
flow of text within a paragraph over page breaks. So for example a
paragraph style might, at the user's pleasure, do any of:
-- control widows and orphans (singleton lines at the beginning/end of
a page)
-- keep lines together (don't break para over a page)
-- keep with next (follow the next paragraph onto a new page)
-- only break over a page between sentences
-- always start a new page
and so on
My multiple page layout code is based on figure 2 on this page:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
TextArchitecture/index.html>
and it works well.
However I am a bit at a loss as to how to implement the page break
control above. I want to use as much of the Cocoa text system as
possible but NSLayoutManager does not offer any obvious ways of
implementing this kind of control.
The best I can do currently is be notified when the Layout Manager
fills up a page, and check to see where the page break fell, then
re-lay the text accordingly inserting a soft NSFormFeed or something.
This feels like a kludge. What I would really like to do is have the
Layout Manager notify me when it is about to lay a paragraph that will
break over a page, and tell me where it intends to break it, giving me
the option of setting an earlier break point that will force it to move
on to the next TextContainer.
Any clues about how I can code this?
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.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