Skip to content
⌘ NSIS Forum Archive

Registering Fonts

2 posts

hms#

Registering Fonts

Hello
I'm relatively new to NSIS, and am working my way through it. I can't seem to get the script to compile when referencing either FontReg.nsh or FontRegAdv.nsh. I'm not sure why what should be the simplest of tasks always turns out to be the hardest. I appreciate any help you can provide. Thank you

I have included the headers(?)
!include FontReg.nsh
!include FontName.nsh
!include WinMessages.nsh

My Font section is:
Section "Fonts"
StrCpy $FONT_DIR $FONTS

!insertmacro InstallTTFFont "Pompiere-Regular.ttf"
!insertmacro InstallTTFFont "Raleway-SemiBold.ttf"

SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd

Errors
Using FontReg with FontName I get the following errors:
1) Error in macro FontName on macroline 3
2) Error in macro InstallTTFFont on macroline 30
3) Error in script "C:\Users\miche\Installer.nsi" on line 598 -- aborting creation process

Lines in Files
1) Call TranslateFontName
2) !insertmacro FontName "$FONT_DIR\${FontFileName}"
3) !insertmacro InstallTTFFont "Pompiere-Regular.ttf"


Font section with the installation directory of the Target Computer
Section "Fonts"
StrCpy $FONT_DIR $FONTS

!insertmacro InstallTTFFont '"$INSTDIR\fonts\Pompiere-Regular.ttf"'
!insertmacro InstallTTFFont '"$INSTDIR\fonts\Raleway-SemiBold.ttf"'

SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd

Errors
Using FontReg with FontName I get the following errors:
1) Error in macro InstallTTFFont on macroline 14
2) Error in script "C:\Users\miche\Installer.nsi" on line 598 -- aborting creation process

Lines in Files
1) IfFileExists "$FONT_DIR\${FontFileName}" ${Index}
2) !insertmacro InstallTTFFont "Pompiere-Regular.ttf"
hms#
I found the answer. This answer applies to the errors on macros line 3 and 30. I was using the x86-ansi directory, but the Font plugin wanted "FontName.dll" in the x86-unicode directory.