From 7657cf3cd9f3ae33e29091a947d76234997ebfd9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Dec 2023 19:46:03 +0300 Subject: =?UTF-8?q?fixes=20#4049=20(NewStory:=20=D0=BF=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D1=80=D1=8B=D1=82=D0=B8=D0=B8=20=D0=BE=D0=BA=D0=BD=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/templates.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins/NewStory/src') diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index 44bcb81c22..952fddeb3b 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -18,6 +18,8 @@ along with this program. If not, see . #include "stdafx.h" +static int g_iPixelY; + wchar_t *weekDays[7] = { LPGENW("Sunday"), LPGENW("Monday"), LPGENW("Tuesday"), LPGENW("Wednesday"), LPGENW("Thursday"), LPGENW("Friday"), LPGENW("Saturday") }; wchar_t *months[12] = @@ -106,11 +108,7 @@ CMStringA ItemData::formatRtf(const wchar_t *pwszStr) cr = g_colorTable[(dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK].cl; buf.AppendFormat("\\red%u\\green%u\\blue%u;}", GetRValue(cr), GetGValue(cr), GetBValue(cr)); - HDC hdc = GetDC(nullptr); - int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(nullptr, hdc); - - buf.AppendFormat("\\uc1\\pard \\cf0\\f0\\b0\\i0\\fs%d ", 2 * abs(F.lf.lfHeight) * 74 / logPixelSY); + buf.AppendFormat("\\uc1\\pard \\cf0\\f0\\b0\\i0\\fs%d ", 2 * abs(F.lf.lfHeight) * 74 / g_iPixelY); AppendUnicodeToBuffer(buf, (pwszStr) ? pwszStr : formatString()); buf.Append("}"); @@ -489,6 +487,10 @@ TemplateInfo templates[TPL_COUNT] = void LoadTemplates() { + HDC hdc = GetDC(nullptr); + g_iPixelY = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(nullptr, hdc); + for (auto &it : templates) replaceStrW(it.value, g_plugin.getWStringA(it.setting)); } -- cgit v1.2.3