Now that I've studied how Papyrix opens a FictionBook2 ebook, how does it render its pages?
Aided by some text-checking utils & skipping over the initializer, finalizer, & reset utils... After clearing some properties & setting the hyphenation language Papyrix's FB2 support lib parses FB2 pages by allocating a buffer, checking whether there's an XML-parser to resume, enters a mainloop, flushing anything remaining in the page, updates its progress, & cleans up.
1/?
If its resuming an existing parser Papyrix's FB2 support library logs what its doing, sums in pending whitespace, & invokes the resume routine on the XML-parser propagating any errors. Otherwise it (re)opens the file retrieving its filesize, reads an initial chunk to determine text-encoding, creates the XML parser, & registers some callbacks.
For each iteration of that mainloop it periodically pats a watchdog timer & checks whether a callback indicates it should abort.
2/?