GRIM/EMI: Text wrapping fixes

94699b8 fixes a buffer overflow when the text to be wrapped does not contain spaces. Previously there was a loop that never terminated, which eventually caused an out of bounds string buffer access. The original code was quite confusing, so I cleaned it up a bit to make it more readable.

e0f088c fixes another issue I noticed when testing the word wrapping. Centered text in the menu in EMI was positioned incorrectly, because the value returned in `Font::getStringLength()` did not match the actual visual length.