]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Text window DPI fix.
authorToni Wilen <twilen@winuae.net>
Wed, 16 Aug 2017 18:39:19 +0000 (21:39 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 16 Aug 2017 18:39:19 +0000 (21:39 +0300)
od-win32/win32gui.cpp
od-win32/win32gui.h
od-win32/win32gui_extra.cpp

index fa45d966f4105fa3133c28ef10f080498347cb38..95c631200595b090c791f4b1083c38fd775f0468 100644 (file)
@@ -2409,7 +2409,7 @@ void gui_infotextbox(HWND hDlg, const TCHAR *text)
        if (hwnd == NULL)
                return;
 
-       HFONT font = CreateFont (12, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Lucida Console"));
+       HFONT font = CreateFont (getscaledfontsize(-1), 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Lucida Console"));
        if (font)
                SendMessage (GetDlgItem (hwnd, IDC_DISKINFOBOX), WM_SETFONT, WPARAM(font), FALSE);
        SendMessage (GetDlgItem (hwnd, IDC_DISKINFOBOX), WM_SETTEXT, 0, (LPARAM)text);
@@ -2476,7 +2476,7 @@ static void infofloppy (HWND hDlg, int n)
        if (hwnd == NULL)
                return;
 
-       HFONT font = CreateFont (12, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Lucida Console"));
+       HFONT font = CreateFont (getscaledfontsize(-1), 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Lucida Console"));
        if (font)
                SendMessage (GetDlgItem (hwnd, IDC_DISKINFOBOX), WM_SETFONT, WPARAM(font), FALSE);
        SendMessage (GetDlgItem (hwnd, IDC_DISKINFOBOX), WM_SETTEXT, 0, (LPARAM)text);
index ae6f374c1747c6138d56f45ad8b87ef87ea79783..ef92810d5fd5d077d46820be0cf41a0f9e575495 100644 (file)
@@ -47,5 +47,5 @@ extern void scaleresource_setdefaults (void);
 extern void scaleresource_setfont (HWND hDlg);
 extern void scaleresource_getdpimult (double*, double*, int*, int*);
 extern void scalaresource_listview_font_info(int*);
-
+extern int getscaledfontsize(int size);
 #endif
index 39449e358eb5d23e0da1da99e6b7957181d880c0..e2b0f52dc420d5b684d18001d29902f7f08d9dfe 100644 (file)
@@ -325,6 +325,16 @@ void freescaleresource (struct newresource *ns)
        xfree (ns);
 }
 
+int getscaledfontsize(int size)
+{
+       HDC hdc = GetDC(NULL);
+       if (size <= 0)
+               size = fontsize_gui;
+       size = -MulDiv(size, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+       ReleaseDC(NULL, hdc);
+       return size;
+}
+
 static void openfont (bool force)
 {
        HDC hdc;