Alexandre Julliard : wineconsole: Scale font with system DPI.

Alexandre Julliard julliard at winehq.org
Wed Oct 10 15:41:01 CDT 2018


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 10 20:45:14 2018 +0200

wineconsole: Scale font with system DPI.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45955
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/wineconsole/registry.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/programs/wineconsole/registry.c b/programs/wineconsole/registry.c
index 9e7a7b6..e892305 100644
--- a/programs/wineconsole/registry.c
+++ b/programs/wineconsole/registry.c
@@ -129,14 +129,8 @@ static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg)
         int height = HIWORD(val);
         int width = LOWORD(val);
         /* A value of zero reflects the default settings */
-        if (height != 0)
-        {
-            cfg->cell_height = height;
-        }
-        if (width != 0)
-        {
-            cfg->cell_width = width;
-        }
+        if (height != 0) cfg->cell_height = MulDiv( height, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
+        if (width != 0) cfg->cell_width = MulDiv( width, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
     }
 
     count = sizeof(val);
@@ -217,8 +211,8 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
     cfg->cursor_visible = 1;
     cfg->exit_on_die = 1;
     memset(cfg->face_name, 0, sizeof(cfg->face_name));
-    cfg->cell_height = 12;
-    cfg->cell_width  = 8;
+    cfg->cell_height = MulDiv( 12, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
+    cfg->cell_width  = MulDiv( 8, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
     cfg->font_weight = FW_NORMAL;
     cfg->history_size = 50;
     cfg->history_nodup = 0;
@@ -265,7 +259,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
 static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg)
 {
     int   i;
-    DWORD val;
+    DWORD val, width, height;
     WCHAR color_name[13];
 
     WINECON_DumpConfig("save", cfg);
@@ -291,7 +285,9 @@ static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg)
 
     RegSetValueExW(hConKey, wszFaceName, 0, REG_SZ, (LPBYTE)&cfg->face_name, sizeof(cfg->face_name));
 
-    val = MAKELONG(cfg->cell_width, cfg->cell_height);
+    width  = MulDiv( cfg->cell_width, USER_DEFAULT_SCREEN_DPI, GetDpiForSystem() );
+    height = MulDiv( cfg->cell_height, USER_DEFAULT_SCREEN_DPI, GetDpiForSystem() );
+    val = MAKELONG(width, height);
     RegSetValueExW(hConKey, wszFontSize, 0, REG_DWORD, (LPBYTE)&val, sizeof(val));
 
     val = cfg->font_weight;




More information about the wine-cvs mailing list