summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-06-18 13:53:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-06-18 13:53:55 +0300
commit47b64a55f3b8866924631ad9c22757eda9fb45c2 (patch)
treea52715330ccca217a72b531faee7b05750af6321
parentddb6b3bc34d9199225cc81ae7eae7578c7a62693 (diff)
fixes #3104 (Изменение размера шрифта в чате делает его гигантским)
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp2
-rw-r--r--src/mir_app/src/FontService.cpp4
-rw-r--r--src/mir_app/src/chat_opts.cpp2
-rw-r--r--src/mir_core/src/Windows/winutil.cpp4
4 files changed, 4 insertions, 8 deletions
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 5e52bbceed..aa22201609 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -60,7 +60,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
}
if (lf) {
mir_snprintf(str, "SRMFont%dSize", i);
- lf->lfHeight = Utils_CorrectFontSize(g_plugin.getByte(str, fontOptionsList[i].defSize));
+ lf->lfHeight = (char)g_plugin.getByte(str, Utils_CorrectFontSize(fontOptionsList[i].defSize));
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp
index 1d8cede252..2f4f300ff2 100644
--- a/src/mir_app/src/FontService.cpp
+++ b/src/mir_app/src/FontService.cpp
@@ -109,10 +109,6 @@ static void GetDefaultFontSetting(LOGFONT *lf, COLORREF *colour)
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), lf, FALSE);
if (colour)
*colour = GetSysColor(COLOR_WINDOWTEXT);
-
- HDC hdc = GetDC(nullptr);
- lf->lfHeight = -MulDiv(lf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY));
- ReleaseDC(nullptr, hdc);
}
int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORREF *colour, uint32_t flags)
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 756caea53b..2fc6966d28 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -106,7 +106,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
}
if (lf) {
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = db_get_b(0, CHATFONT_MODULE, str, Utils_CorrectFontSize(FO.defSize));
+ lf->lfHeight = (char)db_get_b(0, CHATFONT_MODULE, str, Utils_CorrectFontSize(FO.defSize));
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
diff --git a/src/mir_core/src/Windows/winutil.cpp b/src/mir_core/src/Windows/winutil.cpp
index f4e6a84a0e..79a271fdbd 100644
--- a/src/mir_core/src/Windows/winutil.cpp
+++ b/src/mir_core/src/Windows/winutil.cpp
@@ -119,14 +119,14 @@ MIR_CORE_DLL(int) Utils_AssertInsideScreen(RECT *rc)
/////////////////////////////////////////////////////////////////////////////////////////
-static LOGFONTW g_lfDefault;
+static LOGFONTW g_lfDefault = {0};
MIR_CORE_DLL(int) Utils_CorrectFontSize(int size)
{
if (!g_bEnableDpiAware)
return size;
- if (!g_lfDefault.lfWeight)
+ if (!g_lfDefault.lfHeight)
SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(g_lfDefault), &g_lfDefault, FALSE);
return size * g_lfDefault.lfHeight / -12;