View Single Post
Old 09-16-2014, 11:21 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,444
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is nothing that translates a bookmark into a page number. A page number is simply defined as

(number of pages of current html file * frac of file scrolled)/(total number of pages of all current html files)

If you are are asking how the viewer scrolls to a bookmark, look at cfi.coffee

And note that EPUB 3 CFI does not count text nodes. It makes no sense to count text nodes, since:

1) Text nodes can be normalized by the renderer
2) Offsets as numbers of characters in the terminal tag are recorded in the CFI in any case, making counting text nodes totally useless.

What the EPUB CFI spec does is assign odd numbered indices to represent the text between tags regardless of how many actual text nodes there are. So tags are always even numbered.
kovidgoyal is offline   Reply With Quote