Search code examples
nsis

NSIS Display license with a monospace font


Is there a way to display the license of the license page in a NSIS installer with a monospace font?

BTW, I'm doing the traditional:

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY

But the license look pretty weird with the default sans-serif font used by the installer.

Thanks


Solution

  • outfile test.exe
    
    !include WinMessages.nsh
    !include MUI2.nsh
    !insertmacro MUI_PAGE_WELCOME
    !define MUI_PAGE_CUSTOMFUNCTION_SHOW licpageshow
    !insertmacro MUI_PAGE_LICENSE "${__FILE__}"
    !insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_LANGUAGE "English"
    
    Function licpageshow
    FindWindow $0 "#32770" "" $HWNDPARENT
    CreateFont $1 "Courier New" "$(^FontSize)"
    GetDlgItem $0 $0 1000
    SendMessage $0 ${WM_SETFONT} $1 1
    FunctionEnd
    
    Section
    SectionEnd