https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3056f253e430e13f4ad1a8c80b3ffe2705247424

commit 3056f253e430e13f4ad1a8c80b3ffe2705247424
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Wed Jan 24 15:57:45 2024 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Wed Jan 24 15:57:45 2024 +0900

    [SDK] cicuif.h: Fix CUIFMenu::SetMenuFont (#6403)
    
    Supporting Language Bar...
    JIRA issue: CORE-19363
    Implement CUIFMenu::SetMenuFont
    method.
---
 sdk/include/reactos/cicero/cicuif.h | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/sdk/include/reactos/cicero/cicuif.h 
b/sdk/include/reactos/cicero/cicuif.h
index e48cdbad0ab..7ae16842900 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -4487,9 +4487,8 @@ CUIFToolbarMenuButton::CUIFToolbarMenuButton(
 {
     m_pToolbarButton = pParent;
 
-    HFONT hFont = ::CreateFont(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, 
SYMBOL_CHARSET,
-                               OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, 
DEFAULT_QUALITY,
-                               DEFAULT_PITCH | FF_DONTCARE, TEXT("Marlett"));
+    HFONT hFont = ::CreateFontW(8, 8, 0, 0, FW_NORMAL, 0, 0, 0, SYMBOL_CHARSET,
+                                0, 0, 0, 0, L"Marlett");
     SetFont(hFont);
     SetText(L"u"); // downward triangle
 }
@@ -5791,10 +5790,26 @@ inline void CUIFMenu::PostKey(BOOL bUp, WPARAM wParam, 
LPARAM lParam)
     }
 }
 
-/// @unimplemented
 inline void CUIFMenu::SetMenuFont()
 {
-    //FIXME
+    LONG height = 14;
+
+    NONCLIENTMETRICS ncm = { sizeof(ncm) };
+    if (::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0))
+    {
+        HFONT hFont = ::CreateFontIndirect(&ncm.lfMenuFont);
+        SetFont(hFont);
+
+        LONG lfHeight = ncm.lfMenuFont.lfHeight;
+        if (lfHeight < 0)
+            lfHeight = -lfHeight;
+        height = (ncm.iMenuHeight + lfHeight) / 2;
+    }
+
+    m_hMenuFont = ::CreateFontW(height, 0, 0, 0, FW_NORMAL, 0, 0, 0, 
SYMBOL_CHARSET,
+                                0, 0, 0, 0, L"Marlett");
+    INT cxSmallIcon = ::GetSystemMetrics(SM_CXSMICON);
+    m_cxyMargin = max(height, cxSmallIcon) + 2;
 }
 
 inline void CUIFMenu::SetSelectedId(UINT nSelectID)

Reply via email to