'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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anders |
