Signed-off-by: Paul Gofman pgofman@codeweavers.com --- 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..14ce9e73975 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, "FontSmoothingVertical", 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; }