Prev Previous Post   Next Post Next
Old 8th August 2014, 09:36   #1
Mircea M
Junior Member
 
Join Date: Aug 2014
Posts: 44
Issue with installing fonts (FontReg)

I need to install multiple fonts through NSIS, all found in a folder. The content of the folder may change so I don't want to define each font in the NSIS script by name.
I am using (or trying to use) the FontReg plugin.
My nsi looks like this:

code:
!include FontName.nsh
!include FontReg.nsh
!include WinMessages.nsh
!define Fonts_Folder "$EXEDIR\fonts"
OutFile Install_Font.exe

Function Install_GE_Fonts
FindFirst $0 $1 "${Fonts_Folder}\*.TTF"
DetailPrint "Installing ${Fonts_Folder}\$1"
!insertmacro InstallTTFFont "${Fonts_Folder}\$1"

Loop:
IfErrors Done
FindNext $0 $1
IfFileExists "${Fonts_Folder}\$1" IsFile Done
IsFile:
DetailPrint "Installing ${Fonts_Folder}\$1"
!insertmacro InstallTTFFont "${Fonts_Folder}\$1"
Goto Loop

Done:
FindClose $0

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

Section
StrCpy $FONT_DIR $FONTS
Call Install_GE_Fonts
SectionEnd



When I try to compile this I get the following error:
code:
!define: "FontFileName"="$0"
SetOutPath: "$FONT_DIR"
IfFileExists: "$FONT_DIR\$0" ? Line10.6 :
File: "$EXEDIR\fonts\$1" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro InstallTTFFont on macroline 14



If I execute the code with the InstallTTFFont macro lines commented out, I get the full paths and file names of all the fonts I need to install.

Can someone please help?

Thank you!
Mircea M is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump