Re: Pagination experiences

2000-09-22 Thread Geoff Canyon

on 9/21/00 6:26 PM, Kevin Miller at [EMAIL PROTECTED] wrote:

 ...By slow I mean more than a second on a fast computer.
 
 That sounds quite fast: how fast do you need it to be?

Actually, now that you mention it, it is. :-) MetaCard is amazing. But
still, one second on a fast machine could be as much as ten or fifteen
seconds on a slow machine that I would still want to support.

and on 9/21/00 6:35 PM, Scott Raney at [EMAIL PROTECTED] wrote:

 Just one: Use the pageHeights property of the field, which does all of
 this work automatically for you ;-)

You know, nobody likes a wiseguy, Scott :-)

After considering the issue for a moment, I think the pageHeights property
_may_ do the trick, but I'll still have to do a little work (this assumes
constant line heights, which is safe for my application):

1. Put the text from the start to the text that must be included into the
field.
2. Get the page heights.
3. Add up all but the last.
4. Count the pageHeights to see what page I'm on.
5. Figure out the chunk description for the beginning of the last page.
6. Add text, and figure out how much will fit on the last page.
7. Place that text in the field, and put in the page number from step 4.

By the way, the pageHeights doesn't support widow and orphan control, does
it? I'll have to adjust to that.

gc



Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: Pagination experiences

2000-09-22 Thread Jose L. Rodriguez Illera

Geoff,

I have been working on making a both creator and reader 'ebooks', so a I
have needed   paginating a 'book' from a text file.  The best solution I
have found is to use the pageheights property, as Scott suggests in other
response, because it makes the work very well without effort, but  it is not
so fast as you want.

Finding a particular chunk may be done with a simple 'find' command --very
fast in 100 pages or bigger books. Or you have to 'index' the text to know
in which pages a particular word appears, but this a process that takes more
time to build the index.
Regards,

Jose Luis

-
José L. Rodríguez Illera
Universitat de Barcelona
Passeig Vall d'Hebron, 171
08035 Barcelona  --E
 

 
 From: "Geoff Canyon" [EMAIL PROTECTED]
 Subject: Pagination experiences
 Date: Thu, 21 Sep 2000 17:51:35 -0700
 MIME-Version: 1.0
 Content-Type: text/plain;
 charset=us-ascii
 Content-Transfer-Encoding: 7bit
 In-Reply-To: [EMAIL PROTECTED]
 
 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
 computer.
 
 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,
 
 Geoff





Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Pagination experiences

2000-09-21 Thread Geoff Canyon

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
computer.

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,

Geoff



Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.