[PATCH v3 2/7] winex11.drv: Init font smoothing system default parameters in X11DRV_XRender_Init().
Paul Gofman
pgofman at codeweavers.com
Thu Dec 3 04:54:29 CST 2020
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
v3:
- use WineFontSmoothingVertical registry value name.
dlls/winex11.drv/xrender.c | 61 ++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 3376cee517d..dc3bed2bfa0 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -32,6 +32,7 @@
#include "windef.h"
#include "winbase.h"
+#include "winreg.h"
#include "x11drv.h"
#include "winternl.h"
#include "wine/unicode.h"
@@ -314,6 +315,64 @@ static int load_xrender_formats(void)
return count;
}
+static void set_default_font_smoothing(void)
+{
+ DWORD smoothing_type, orientation, vertical;
+ BOOL smoothing;
+ HKEY sysparam_key;
+ char *value;
+
+ if ((value = XGetDefault( gdi_display, "Xft", "antialias" )))
+ {
+ TRACE( "got antialias '%s'.\n", value );
+ smoothing = !(tolower(value[0]) == 'f' || tolower(value[0]) == 'n' ||
+ value[0] == '0' || !_strnicmp( value, "off", -1 ));
+ SystemParametersInfoA(SPI_SETFONTSMOOTHING, smoothing, NULL, 0);
+ }
+ else
+ {
+ if (!SystemParametersInfoA(SPI_GETFONTSMOOTHING, 0, &smoothing, 0))
+ smoothing = FALSE;
+ }
+
+ if ((value = XGetDefault( gdi_display, "Xft", "rgba" )))
+ {
+ TRACE( "got rgba '%s'.\n", value );
+
+ vertical = 0;
+ orientation = smoothing_type = ~0u;
+ if (!strcmp( value, "rgb" ) || (vertical = !strcmp( value, "vrgb" )))
+ {
+ smoothing_type = FE_FONTSMOOTHINGCLEARTYPE;
+ orientation = FE_FONTSMOOTHINGORIENTATIONRGB;
+ }
+ else if (!strcmp( value, "bgr" ) || (vertical = !strcmp( value, "vbgr" )))
+ {
+ smoothing_type = FE_FONTSMOOTHINGCLEARTYPE;
+ orientation = FE_FONTSMOOTHINGORIENTATIONBGR;
+ }
+ else if (!strcmp( value, "none" ))
+ {
+ smoothing_type = FE_FONTSMOOTHINGSTANDARD;
+ }
+
+ if (smoothing)
+ {
+ if (smoothing_type != ~0u)
+ SystemParametersInfoA(SPI_SETFONTSMOOTHINGTYPE, 0, (void *)(ULONG_PTR)smoothing_type, 0);
+ if (orientation != ~0u)
+ SystemParametersInfoA(SPI_SETFONTSMOOTHINGORIENTATION, 0, (void *)(ULONG_PTR)orientation, 0);
+ }
+
+ if (smoothing_type != ~0u && !RegOpenKeyA( HKEY_CURRENT_USER,
+ "Software\\Wine\\Temporary System Parameters\\Control Panel\\Desktop", &sysparam_key ))
+ {
+ RegSetValueExA( sysparam_key, "WineFontSmoothingVertical", 0, REG_DWORD, (BYTE *)&vertical, sizeof(vertical) );
+ RegCloseKey( sysparam_key );
+ }
+ }
+}
+
/***********************************************************************
* X11DRV_XRender_Init
*
@@ -379,6 +438,8 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
}
glyphsetCache[i-1].next = -1;
+ set_default_font_smoothing();
+
return &xrender_funcs;
}
--
2.28.0
More information about the wine-devel
mailing list