You are likely looking for WinMenuSelectItem
From the docs: Invokes a menu item from the menu bar of the specified
window.
WinMenuSelectItem, WinTitle, WinText, Menu , SubMenu1, SubMenu2, SubMenu3, SubMenu4, SubMenu5, SubMenu6, ExcludeTitle, ExcludeText
So for the Notepad font example, the Font setting is located in Format>Font of the Notepad menu. So, you could use something like:
#IfWinActive ahk_class Notepad ;If Notepad is active
^q::WinMenuSelectItem, A, , Format, Font ;Open Format>Font of actitve window
#If
to trigger the command on Control+q if notepad is the active window.