- NSIS Discussion
- Installing fonts script error with InstallTTFFont (FontReg)
Archive: Installing fonts script error with InstallTTFFont (FontReg)
mattwilkinson
2nd March 2005 12:49 UTC
Installing fonts script error with InstallTTFFont (FontReg)
I am having problems trying to use the FontReg macro. I have included the fontreg and fontname .nsh files and have put the !include at the top of my script.
I am calling the code using this:
SetOutPath "$FONTS"
File "${SOURCEDIR}\FREE.ttf"
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont 'FREE.TTF'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
When compiling the script - I get this error:
StrCpy $FONT_DIR "$FONTS" () ()
!insertmacro: InstallTTFFont
Push: $R0
Push: $R1
Push: $R2
!define: "Index"="Line1183.5"
SetOutPath: "$FONT_DIR"
IfFileExists: "$FONT_DIR\FREE.TTF" ? Line1183.5 :
File: "FREE.TTF" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro InstallTTFFont on macroline 9
I think that I am not doing something simple but can't figure out what it is . Can anyone help????
Afrow UK
2nd March 2005 14:34 UTC
Well, what does it say? "File: "FREE.TTF" -> no files found"
You are passing the path to FREE.TTF to the macro, but you haven't specified the proper path. Unless the font file is in the same folder as your script, you need to make sure you specify the full path, e.g C:\font.ttf
-Stu
mattwilkinson
3rd March 2005 10:43 UTC
That's it, thanks.
The next headache is that I get an invalid file handle reported by the macro.
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont '${SOURCEDIR}\FREE.TTF'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
Any clues?
Afrow UK
3rd March 2005 14:17 UTC
Firstly make sure you have HWND_BROADCAST defined as a variable, e.g.
Var $hwnd
!define HWND_BROADCAST $hwnd
and make sure you !include WinMessages.nsh.
Both need to be at the top of your script.
-Stu
kichik
3rd March 2005 19:29 UTC
HWND_BROADCAST is defined in WinMessages.nsh. You shouldn't define it as $hwnd, it's already defined as 0xFFFF.
Huette
8th August 2005 16:32 UTC
I've got a similar problem and can't figure out what's wrong. The Error is:
Section: "Systemfiles" ->(SystemFiles)
StrCpy $FONT_DIR "$WINDIR\Fonts" () ()
SetOutPath: "$FONT_DIR"
File: "webdings.ttf" 118752 bytes
File: "ariblk.ttf" 117028 bytes
!insertmacro: InstallTTFFont
Push: $0
Push: $R0
Push: $R1
Push: $R2
!define: "Index"="Line221.6"
!insertmacro: GetFileNameCall
Push: webdings.TTF
Call "GetFileName"
Pop: $0
!insertmacro: end of GetFileNameCall
!define: "FontFileName"="$0"
SetOutPath: "$FONT_DIR"
IfFileExists: "$FONT_DIR\$0" ? Line221.6 :
File: "webdings.TTF" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro InstallTTFFont on macroline 14
Error in script "D:\Updates\Ready4Risk\Update Ready4Risk.nsi" on line 221 -- aborting creation process
This is my section:
Section "Systemfiles" SystemFiles
StrCpy $FONT_DIR "$WINDIR\Fonts"
SetOutPath "$FONT_DIR"
File "D:\Quellen\Fonts\webdings.ttf"
File "D:\Quellen\Fonts\ariblk.ttf"
!insertmacro InstallTTFFont 'webdings.TTF'
!insertmacro InstallTTFFont 'ariblk.ttf'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
File "D:\Quellen\Fonts\webdings.ttf" -> is definetly the correct path to the font
Afrow UK
8th August 2005 17:37 UTC
The InstallTTFFont macro already contains code to compress your font file,.so you don't need any File commands first.
Make sure webdings.TTF and ariblk.ttf is in the same folder as your installer script.
-Stu
Huette
9th August 2005 07:27 UTC
Thanks! Works fine.
Dark^Listner
21st May 2008 00:55 UTC
Hello, i have a problem looks very similar to threat intro
When i compile my script this is my abortmessage:
File: "gplatten.ace" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "P:\installscript.nsi" on line 6742 -- aborting creation process
I trieed to replace this file with a new version, maybe why i get this message, but hey how can i replace some files which are in my script whithout writing a new one
Maybe anyone of us can help me.
Thanks
DL
pospec
21st May 2008 08:58 UTC
Try to use your editor's Search&Replace feature.
bazald
18th July 2008 02:00 UTC
Originally posted by mattwilkinson The next headache is that I get an invalid file handle reported by the macro.
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont '${SOURCEDIR}\FREE.TTF'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
I'm having the same problem as the above poster, with "invalid file handle 32" reported on the Windows XP system on which I'm trying to run the installer. On the other hand, my Vista (x64) system seems to run the installer fine.
It didn't seem like he had any real resolution to this issue. If the solution is known, sorry for the thread resurection. In any case, thanks in advance.
robertinventor
12th March 2010 00:16 UTC
I got an "invalid file handle 3" (3 for some reason instead of 32) but probably same problem.
Here is my code that fixed it:
FIXED VERSION
!include FontReg.nsh
>!include FontName.nsh
>!include WinMessages.nsh.
>Section "Install Bach 4.1 Musicological Font"
>SectionIn 1 2
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont 'BACH41.TTF'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
>
where I placed BACH41.TTF into the same folder as the script
Before, it was something like this:
VERSION WITH ERROR MESSAGE ON WINDOWS 7
!insertmacro InstallTTFFont '${SourceFolder}\\BACH41.TTF'
which lead to the error message - so fixed by putting the ttf file in the same folder as the .nsi script.
Got the file error message on Windows 7.
robertinventor
12th March 2010 00:18 UTC
btw formatted the script as php just to get the colour coding.