Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/gdiplus/graphics.c | 2 +- dlls/gdiplus/tests/graphics.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
This doesn't seem right to me (though, neither does the code we have now for NoWrap).
If I understand correctly, the current behavior for functions other than GdipMeasureString is that we will end the line as if it had wrapped and then stop drawing the string right there. This behavior makes no sense to me, but for all I know it could be correct.
I think you are changing it so that it draws the last character that fits and stops drawing the string. I would expect that it should still draw a character that partially fits, and possibly the rest of the line as well.
I think we will need a test program that draws the string and measurement rectangles to understand how this is supposed to work and verify the correctness of your patch.
Fortunately, I already have one that I can easily modify, so I'll get right to it.
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.
Thanks so much for the testing!
On 10/23/20 12:23 PM, Esme Povirk (they/them) wrote:
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.