Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:Emulators:Wine
wine
0001-Fix-Font-display-problem-text-and-dc-rotat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-Font-display-problem-text-and-dc-rotation-using-.patch of Package wine
From 0008617f3af38ccac1e884641cc0e000ac10f733 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov <dmitry@baikal.ru> Date: Wed, 7 Feb 2024 19:14:29 +0300 Subject: [PATCH 1/2] win32u: Fix device<->world width/height converters. Content-Type: text/plain; charset=UTF-8 Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> --- dlls/win32u/font.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 9ee89f1b5c4..44c3157cb09 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -228,10 +228,12 @@ static inline int facename_compare( const WCHAR *str1, const WCHAR *str2, SIZE_T */ static inline INT INTERNAL_XDSTOWS(DC *dc, INT width) { - double floatWidth; + float floatWidth, scale_x; + + scale_x = sqrtf(dc->xformVport2World.eM11 * dc->xformVport2World.eM11 + dc->xformVport2World.eM12 * dc->xformVport2World.eM12); /* Perform operation with floating point */ - floatWidth = (double)width * dc->xformVport2World.eM11; + floatWidth = (float)width * scale_x; /* Round to integers */ return GDI_ROUND(floatWidth); } @@ -241,10 +243,12 @@ static inline INT INTERNAL_XDSTOWS(DC *dc, INT width) */ static inline INT INTERNAL_YDSTOWS(DC *dc, INT height) { - double floatHeight; + float floatHeight, scale_y; + + scale_y = sqrtf(dc->xformVport2World.eM21 * dc->xformVport2World.eM21 + dc->xformVport2World.eM22 * dc->xformVport2World.eM22); /* Perform operation with floating point */ - floatHeight = (double)height * dc->xformVport2World.eM22; + floatHeight = (float)height * scale_y; /* Round to integers */ return GDI_ROUND(floatHeight); } @@ -253,22 +257,24 @@ static inline INT INTERNAL_YDSTOWS(DC *dc, INT height) static inline INT width_to_LP( DC *dc, INT width ) { - return GDI_ROUND( (double)width * fabs( dc->xformVport2World.eM11 )); + return INTERNAL_XDSTOWS( dc, width ); } static inline INT height_to_LP( DC *dc, INT height ) { - return GDI_ROUND( (double)height * fabs( dc->xformVport2World.eM22 )); + return INTERNAL_YDSTOWS( dc, height ); } static inline INT INTERNAL_YWSTODS(DC *dc, INT height) { - POINT pt[2]; - pt[0].x = pt[0].y = 0; - pt[1].x = 0; - pt[1].y = height; - lp_to_dp(dc, pt, 2); - return pt[1].y - pt[0].y; + float floatHeight, scale_y; + + scale_y = sqrtf(dc->xformVport2World.eM21 * dc->xformVport2World.eM21 + dc->xformVport2World.eM22 * dc->xformVport2World.eM22); + + /* Perform operation with floating point */ + floatHeight = (float)height / scale_y; + /* Round to integers */ + return GDI_ROUND(floatHeight); } static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer ); @@ -4195,8 +4201,8 @@ static void scale_outline_font_metrics( const struct gdi_font *font, OUTLINETEXT else scale_x = font->scale_y; - scale_x *= fabs(font->matrix.eM11); - scale_y = font->scale_y * fabs(font->matrix.eM22); + scale_x *= sqrtf(font->matrix.eM11 * font->matrix.eM11 + font->matrix.eM12 * font->matrix.eM12); + scale_y = font->scale_y * sqrtf(font->matrix.eM21 * font->matrix.eM21 + font->matrix.eM22 * font->matrix.eM22); /* Windows scales these values as signed integers even if they are unsigned */ #define SCALE_X(x) (x) = GDI_ROUND((int)(x) * (scale_x)) @@ -4410,8 +4416,8 @@ static void scale_font_metrics( struct gdi_font *font, TEXTMETRICW *tm ) else scale_x = font->scale_y; - scale_x *= fabs(font->matrix.eM11); - scale_y = font->scale_y * fabs(font->matrix.eM22); + scale_x *= sqrtf(font->matrix.eM11 * font->matrix.eM11 + font->matrix.eM12 * font->matrix.eM12); + scale_y = font->scale_y * sqrtf(font->matrix.eM21 * font->matrix.eM21 + font->matrix.eM22 * font->matrix.eM22); #define SCALE_X(x) (x) = GDI_ROUND((x) * scale_x) #define SCALE_Y(y) (y) = GDI_ROUND((y) * scale_y) -- 2.42.1 From 54a6b89e564e0274d72929e8a4429577da0a3097 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov <dmitry@baikal.ru> Date: Wed, 22 Nov 2023 11:51:23 +0300 Subject: [PATCH 2/2] win32u: NtGdiExtTextOutW() should translate x,y from logical to device units at the last step. Content-Type: text/plain; charset=UTF-8 Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> --- dlls/win32u/font.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 44c3157cb09..dd38a403e21 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -5973,12 +5973,6 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr goto done; } - pt.x = x; - pt.y = y; - lp_to_dp(dc, &pt, 1); - x = pt.x; - y = pt.y; - char_extra = dc->attr->char_extra; if (char_extra && lpDx && NtGdiGetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER) char_extra = 0; /* Printer drivers don't add char_extra if lpDx is supplied */ @@ -6144,6 +6138,12 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr } } + pt.x = x; + pt.y = y; + lp_to_dp(dc, &pt, 1); + x = pt.x; + y = pt.y; + ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc, str, count, (INT*)deltas ); -- 2.42.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor