Signed-off-by: Esme Povirk esme@codeweavers.com
Having written a test program:
Windows draws the line up to the last character that fully fits, just as your patch does.
The measured width is based on the characters drawn, which also matches your patch.
There are some differences. On Windows, the second line is always drawn, but on Wine it is only drawn if the first line fits. Windows will draw a partial line, clipping it to the height, but Wine will draw the full line. If a partial line fits, heights from MeasureString and MeasureCharacterRanges on Windows are clipped to the rectangle passed in, while on Wine these functions behave as if the line hasn't been rendered. Also, Wine's MeasureCharacterRanges will sometimes return rectangles for characters that aren't being rendered.
These problems existed already and are not caused by your patch, and it does get us closer to the correct behavior. So while it would be nice to fix them, I think it's OK to accept your patch as-is.