View Single Post
Old 02-12-2011, 09:47 AM   #38
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
I've tweaked the character count for estimating a page. It about doubles the number of characters per page. I've changed it from 1024 to 2300. This takes into account the average number of characters in a page in my test book and gives some overhead for markup.

Please remember this is never going to be 1 to 1 in a paper back book. In some cases it will be more and some cases it will be less. We are estimating page length based on the number of characters because we cannot take the time to decompress and parse the text.

The disadvantage of using a character count is pages with short (dialog) will create longer pages then long paragraphs. Making the page count shorter than the paper back.

A better but much more resource intensive and slower method to calculate the page length would be to parse the uncompressed text. For each paragraph we would want to find how many lines it would occupy in a paper back book. 70 characters per line and 32 lines per page. So divide the number of characters (minus markup) in each paragraph by 70. If there are less than 70 characters in the paragraph then it is 1 line. Then, count every 32 lines and mark that location as a page.

However, I'm not going to use the better method because it will take a lot of resources and too much time processing for such a feature. Sending to device should take seconds not minutes. If someone (goaspy) wants to make an external tool that will generate pages based on the above method, that would be your best bet for getting almost 1 to 1 page numbers.
user_none is offline   Reply With Quote