It's not a problem of this patch, but existing issue with gdip_format_string(). Should it really be that limited regarding line breaks, and wrapping (wrt to whitespace handling). Measurements interleaved by string character checks is not how this normally works - first it should identify where it can possibly break, taking in account mandatory breaks, and points where it shouldn't break, for example for combining marks. After that itemization, shaping, building lines. I'm mentioning all that because existing code is already hard to follow.