Zhiyi Zhang : winecfg: Don't convert font height to points when saving system font metrics.

Alexandre Julliard julliard at winehq.org
Fri Jul 2 14:46:39 CDT 2021


Module: wine
Branch: master
Commit: 5cebefc24fe9dd944fd8656fd1b160d51bf7ec80
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5cebefc24fe9dd944fd8656fd1b160d51bf7ec80

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Fri Jul  2 11:38:31 2021 +0800

winecfg: Don't convert font height to points when saving system font metrics.

Fix tooltip font size becomes smaller after clicking the apply button in Desktop Integration tab.
For example, the original non-client area tooltip font lfHeight is -11. 11 pixels is 8 points in 96
DPI. Setting font size to 8 points to SPI_SETNONCLIENTMETRICS will make SPI_GETNONCLIENTMETRICS
report lfHeight as 8. With lfHeight being 8, CreateFontIndirectW() creates a smaller font. This
behavior is added by 5b8fdb9. I assume the intention was to save font size in a DPI-independent way.
However, when lfHeight is negative, lfHeight will still be scaled back to 96 DPI before saving it to
registry and scaled to system DPI when it's read from registry. So I think converting to points is
unnecessary.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winecfg/theme.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c
index 687ea571311..e204a911516 100644
--- a/programs/winecfg/theme.c
+++ b/programs/winecfg/theme.c
@@ -1035,12 +1035,6 @@ static void apply_sysparams(void)
     ncm.lfStatusFont  = metrics[IDC_SYSPARAMS_TOOLTIP_TEXT - IDC_SYSPARAMS_BUTTON].lf;
     ncm.lfMessageFont = metrics[IDC_SYSPARAMS_MSGBOX_TEXT - IDC_SYSPARAMS_BUTTON].lf;
 
-    ncm.lfMenuFont.lfHeight    = MulDiv( ncm.lfMenuFont.lfHeight, -72, dpi );
-    ncm.lfCaptionFont.lfHeight = MulDiv( ncm.lfCaptionFont.lfHeight, -72, dpi );
-    ncm.lfStatusFont.lfHeight  = MulDiv( ncm.lfStatusFont.lfHeight, -72, dpi );
-    ncm.lfMessageFont.lfHeight = MulDiv( ncm.lfMessageFont.lfHeight, -72, dpi );
-    ncm.lfSmCaptionFont.lfHeight = MulDiv( ncm.lfSmCaptionFont.lfHeight, -72, dpi );
-
     SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(ncm), &ncm,
                           SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
 




More information about the wine-cvs mailing list