[PATCH] gdiplus: If the font unit is not pixels scaling should not be applied.

Dmitry Timoshkov dmitry at baikal.ru
Thu Jan 23 00:35:39 CST 2020


I don't see a way of adding a test case for this, I'm attaching a test app
(source + binary) that visually shows problematic behaviour.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/gdiplus/graphics.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index e485e5c99f..c52fa65445 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2276,6 +2276,12 @@ static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
                      (pt[1].X-pt[0].X)*(pt[1].X-pt[0].X));
     rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
+    /* If the font unit is not pixels scaling should not be applied */
+    if (font->unit != UnitPixel && font->unit != UnitWorld)
+    {
+        rel_width /= graphics->scale;
+        rel_height /= graphics->scale;
+    }
 
     get_log_fontW(font, graphics, &lfw);
     lfw.lfHeight = -gdip_round(font_height * rel_height);
-- 
2.20.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scale_text.tar.xz
Type: application/x-xz
Size: 7984 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200123/b0abba54/attachment-0001.xz>


More information about the wine-devel mailing list