I noticed that unless I use a non-zero value for linebreakpos, extra whitespace will be left in the output. I've not traced why this is happening yet.