Rework book formatter (Fixes #1148)

Tested on quite a few books with positive results. Replicates the vanilla layouts as closely as possible, fixing a lot of bugs in the current formatter. The only minor problem would be that texts in vanilla are slightly shorter, causing that the word wrapping does not always match, which may or may not be a scaling bug in vanilla MW.

Next thing is that when an editbox is split, all empty lines at the beginning of the next page should be removed. While I have implemented that, it requires the latest, not yet released, version of mygui which adds the EditText::getLineInfo method.
Infinite loop if image is larger than the page?