I have been trying to build an installer in NSIS that installs a font file. Here's my main installer script:
!include FontName.nsh
!include FontReg.nsh
!include WinMessages.nsh
RequestExecutionLevel admin
InstallDir $DESKTOP
Name "Orange Juice"
OutFile fonttest.exe
Section "install"
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont "orangejuice.ttf"
DetailPrint "Installing Orange Juice Font..."
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
I got the file FontReg.nsh from here and copied it verbatim into my Program Files\NSIS\Include
folder. I got the file FontName.nsh (along with the corresponding DLL file) from here and copied those verbatim. Yet... when I run this script, the font doesn't get installed. What am I missing?
FontReg.nsh
defines its proper variable to get the font installation directory while you are defining a constant with the same name that does not what you think, also you can use directly the $FONTS
variable that points to the system font directoryWM_FONTCHANGE
messageTry the following: Delete your !define FONT_DIR
line and change your section with
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont "orangejuice.ttf"
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000