Word positioning rework

* reworked the code to process words and states before output
* added a simple algorithm for detecting spaces when they are missing from the pdf
* solved some letter spacing issues
* solved some word positioning issues