简体   繁体   中英

How can I change the font of the captions in NSIS?

I am trying to change the font of the captions in NSIS, and I am looking for script lines that change the font of the captions in NSIS.

SetFont sets the base font used by the UI. MUI creates some custom fonts but base them on the ^Font and ^FontSize lang-strings set by SetFont . Colors are separate from the font and are set with a couple of MUI defines and SetCtlColors .

If you want custom fonts (different from SetFont ) in various places then you must set them yourself manually:

SetFont "Comic Sans MS" 9
!include MUI2.nsh
!define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
!define MUI_TEXTCOLOR 00AAAA
!define MUI_BGCOLOR FFAAAA

!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW onCompsShow
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_STARTMENU SMP $9
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

var MyFont

Function MyGuiInit
IntOp $2 $(^FontSize) + 5
CreateFont $1 "Impact" "$2"
SendMessage $mui.Header.Text ${WM_SETFONT} $1 1
CreateFont $MyFont "Terminal" "$(^FontSize)"
SendMessage $mui.Header.SubText ${WM_SETFONT} $MyFont 1
FunctionEnd

Function onCompsShow
SendMessage $mui.ComponentsPage.Text ${WM_SETFONT} $MyFont 1
FunctionEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM