I'm wondering if anyone here has experience writing pagination routines in
MetaCard. I'm considering writing a routine that would take a 50-100k block
of text, a font, a font size, a field size, and figure out where the page
breaks should occur from beginning to end.
The actual goal is to be able to go to an arbitrary chunk of the text, and
know what page number to put under it.
My first instinct is to use the height of the field and the formattedHeight
function on chunks of text, finding page-sized chunks and counting them
until I get to the chunk I want to display. but this is fairly slow across
perhaps hundreds of pages. By slow I mean more than a second on a fast
But my second instinct is to figure out how many lines will fit onto one
page, figure out how tall those lines are individually, and then just search
for the largest n such that n*(the number of lines that will fit on a page)
is still less than the chunk I want to display, and then use n+1 for a page
number. I'm sure that's not clear, but if someone's done it, I'm betting it
will be clear to them. This might be much faster, but will it work?
Thanks to anyone who has a suggestion,
Please send bug reports to <[EMAIL PROTECTED]>, not this list.