littlerob
12th May 2006 16:41 UTC
Font installation
Hi
i'm trying to get my app to install a font. I've downloaded the fontName and fontNameAdv stuff from Vytautas but I can't get it to work.
The .nsh files seem to be in th eright place, as does the dll but my code
!include FontRegAdv.nsh
!include FontName.nsh
!define FontBackup Software\myapp\Telnet
Section "Fonts"
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTF 'D:\AProducts\Utilities\Telnet\fonts\linedraw.ttf'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
gives me the error
!insertmacro: InstallTTF
Push: $0
Push: $R0
Push: $R1
Push: $R2
Push: $R3
!define: "Index"="Line207.7"
!insertmacro: GetFileNameCall
!insertmacro: macro "GetFileNameCall" requires 2 parameter(s), passed 3!
Error in macro InstallTTF on macroline 10
Error in script "D:\AProducts\Utilities\Setup\NSIS\telnet_setup.nsi" on line 207 -- aborting creation process
Any ideas where I'm going wrong?
Rob
littlerob
12th May 2006 17:17 UTC
B*ggerit.
I've found the problem. I simplified the example, and in doing so completely removed the problem. Its actually that InstallTTF doesn't like filenames with spaces. The real line was more like
!insertmacro InstallTTF 'D:\AProducts\My Utilities\Telnet\fonts\linedraw.ttf'
and this caused the error.
So sorry for confusing anybody, but it is a genuine bug I believe.
Rob
Afrow UK
12th May 2006 19:24 UTC
It is indeed. You should contact the author and get him to put quotes around his parameters for GetFileNameCall.
He's probably using:
!insertmacro GetFileNameCall ... ${File}
Where ${File} will be 'D:\AProducts\My Utilities\Telnet\fonts\linedraw.ttf', which contains a space and thus ${File} becomes two parameters and not one. He needs to use "${File}" to make it one parameter again.
-Stu
foxmt
15th May 2006 09:59 UTC
I'm using this to install fonts:
IfFileExists "$FONTS\Forgotti.ttf" FontOK
SetOutPath "$FONTS"
File "..\..\Common\Font\*.*"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Forgotten Futurist" "Forgotte.ttf"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Forgotten Futurist Italic" "Forgotti.ttf"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Forgotten Futurist Bold" "Forgottb.ttf"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Forgotten Futurist Bold Italic" "Forgotbi.ttf"
StrCpy $FONT_DIR $FONTS
GetTempFileName $R0
File /oname=$R0 "..\..\Common\Font\Fonts.dll" ;on met la dll dans l'Install et dans le dossier temporaire lors de son exécution
Push "Forgotti.ttf"
CallInstDLL $R0 registerFont ;utilisation de la dll pour enregistrer la fonte
GetTempFileName $R0
Pop $R0
Push "Forgotte.ttf"
CallInstDLL $R0 registerFont ;utilisation de la dll pour enregistrer la fonte
GetTempFileName $R0
Pop $R0
Push "Forgottb.ttf"
CallInstDLL $R0 registerFont ;utilisation de la dll pour enregistrer la fonte
GetTempFileName $R0
Pop $R0
Push "Forgotti.ttf"
CallInstDLL $R0 registerFont ;utilisation de la dll pour enregistrer la fonte
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
FontOK:
fonts::registerFont "Forgotte.ttf" ;utilisation de la dll pour enregistrer la fonte
fonts::registerFont "Forgotti.ttf" ;utilisation de la dll pour enregistrer la fonte
fonts::registerFont "Forgottb.ttf" ;utilisation de la dll pour enregistrer la fonte
fonts::registerFont "Forgotbi.ttf" ;utilisation de la dll pour enregistrer la fonte