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