Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 2nd March 2005, 11:49   #1
mattwilkinson
Junior Member
 
Join Date: Dec 2004
Location: Stoke on Trent UK
Posts: 18
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????
mattwilkinson is offline   Reply With Quote
Old 2nd March 2005, 13:34   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 3rd March 2005, 09:43   #3
mattwilkinson
Junior Member
 
Join Date: Dec 2004
Location: Stoke on Trent UK
Posts: 18
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?
mattwilkinson is offline   Reply With Quote
Old 3rd March 2005, 13:17   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 3rd March 2005, 18:29   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
HWND_BROADCAST is defined in WinMessages.nsh. You shouldn't define it as $hwnd, it's already defined as 0xFFFF.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th August 2005, 15:32   #6
Huette
Member
 
Join Date: Apr 2005
Posts: 57
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
Huette is offline   Reply With Quote
Old 8th August 2005, 16:37   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th August 2005, 06:27   #8
Huette
Member
 
Join Date: Apr 2005
Posts: 57
Thanks! Works fine.
Huette is offline   Reply With Quote
Old 20th May 2008, 23:55   #9
Dark^Listner
Junior Member
 
Join Date: Jul 2007
Posts: 5
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
Dark^Listner is offline   Reply With Quote
Old 21st May 2008, 07:58   #10
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Try to use your editor's Search&Replace feature.
pospec is offline   Reply With Quote
Old 18th July 2008, 01:00   #11
bazald
Junior Member
 
Join Date: Jul 2008
Posts: 1
Quote:
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.
bazald is offline   Reply With Quote
Old 11th March 2010, 23:16   #12
robertinventor
Junior Member
 
Join Date: Mar 2010
Posts: 2
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
PHP Code:
!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_FONTCHANGE0 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
PHP Code:
  !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 is offline   Reply With Quote
Old 11th March 2010, 23:18   #13
robertinventor
Junior Member
 
Join Date: Mar 2010
Posts: 2
btw formatted the script as php just to get the colour coding.
robertinventor is offline   Reply With Quote
Reply
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