[2/2] gdi32: Replace DC transform by font scaling for bitmap fonts

Dmitry Timoshkov dmitry at codeweavers.com
Thu Aug 21 01:02:15 CDT 2008


Hello,

Since gdi32 in Wine doesn't perform world transforms for bitmap fonts
this patch goes backward and does what was done before my recent changes
for bitmap fonts.

This fixes a crash caused by regression reported in the bug 14268.

Changelog:
    gdi32: Replace DC transform by font scaling for bitmap fonts.
---
 dlls/gdi32/freetype.c   |    6 ++++++
 dlls/gdi32/tests/font.c |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index d569735..8bd75cb 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3555,6 +3555,12 @@ found:
         /* Windows uses integer scaling factors for bitmap fonts */
         INT scale, scaled_height;
 
+        /* FIXME: rotation of bitmap fonts is ignored */
+        height = abs(GDI_ROUND( (double)height * ret->font_desc.matrix.eM22 ));
+        if (ret->aveWidth)
+            ret->aveWidth = (double)ret->aveWidth * ret->font_desc.matrix.eM11;
+        ret->font_desc.matrix.eM11 = ret->font_desc.matrix.eM22 = 1.0;
+
         if (height != 0) height = diff;
         height += face->size.height;
 
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 7065cd5..7d2c036 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -30,7 +30,7 @@
 
 #include "wine/test.h"
 
-#define near_match(a, b) (abs((a) - (b)) <= 4)
+#define near_match(a, b) (abs((a) - (b)) <= 6)
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
 LONG  (WINAPI *pGdiGetCharDimensions)(HDC hdc, LPTEXTMETRICW lptm, LONG *height);
-- 
1.6.0






More information about the wine-patches mailing list