Fix misformatted SVG when writing text as text. Ensure whitespace isn't lost.