gdollard
31st August 2011 14:25 UTC
Installing a Font - Help!!
Hi All,
I'm really stuck on this one. I have a script that installs two fonts, (Andale Mono and arialUnicode) on XP using InstallTTF from FontRegAdv.nsh.
The odd behavior I get is when adnalemo is not installed on the machine the installer throws up a dialog saying "Invalid File Handle 32" and the font is not installed.
However if I remove the arialUnicode font and run the installer it does install that font no problem!
I'm puzzled as to why it has a problem with the Andale Mono font! Odd.
I'm new to all this as I'm sure you'll realise from my problem!!
here's the code:
strCpy $FONT_DIR $FONTS
!insertmacro InstallTTF "$INSTDIR\Fonts\andalemo.ttf" $FONTS
!insertmacro InstallTTF '$INSTDIR\Fonts\arialUnicode.ttf' $FONTS
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
The font files are in the same folder so I don't understand what's going wrong!
Any help would be greatly appreciated!
Thanks.
gdollard
31st August 2011 16:13 UTC
any help at all folks? I'm at a loss here :cry:
gdollard
1st September 2011 13:44 UTC
thankfully I've managed to sort this myself...I'd be a long time waiting for it here.
MSG
1st September 2011 20:47 UTC
You're welcome for nothing. :D
Ttrebla
29th November 2012 09:14 UTC
Hi, I'm having exactly the same problem here.
gdollard, do you remember how did you solve it?
Thanks!
gdollard
29th November 2012 10:58 UTC
hi Ttrebla, it's been a long time since I've looked at this but I think the problem was confined to XP machines and if memory serves I had to check for the existence of the the font on the target machine and remove it before 'installing' it again in the nsis script.
Not very scientific I know but it seemed to work.
PoRtAbLe_StEaLtH
6th December 2012 04:08 UTC
Quote:
here's what i use:
StrCpy $FontFolder "$INSTDIR\MyApp"
>System::Call "gdi32::AddFontResource(t'$FontFolder')i .r2"
>SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=1
>
works for me on all systems..
haven't had a problem yet..
if you have more than 1 font..
use "Find" (first,next,close).
Originally Posted by gdollard (Post 2798878) Hi All,
I'm really stuck on this one. I have a script that installs two fonts, (Andale Mono and arialUnicode) on XP using InstallTTF from FontRegAdv.nsh.
The odd behavior I get is when adnalemo is not installed on the machine the installer throws up a dialog saying "Invalid File Handle 32" and the font is not installed.
However if I remove the arialUnicode font and run the installer it does install that font no problem!
I'm puzzled as to why it has a problem with the Andale Mono font! Odd.
I'm new to all this as I'm sure you'll realise from my problem!!
here's the code:
strCpy $FONT_DIR $FONTS
!insertmacro InstallTTF "$INSTDIR\Fonts\andalemo.ttf" $FONTS
!insertmacro InstallTTF '$INSTDIR\Fonts\arialUnicode.ttf' $FONTS
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
The font files are in the same folder so I don't understand what's going wrong!
Any help would be greatly appreciated!
Thanks.
|
Anders
6th December 2012 09:10 UTC
Timeout=1 seems a little short IMHO...
sols_HeG
11th December 2012 15:01 UTC
hey there,
i used the fonts-plugin to install my constum fonts, because INSTALLTTF made too much problems and work for me.
Set the Outputpath to the System-Fontfolder
System::Call 'shell32::SHGetSpecialFolderPathA(i $HWNDPARENT, t .r1, i ${CSIDL_FONTS}, i 0) i r0'
SetOutPath $1
Add the ttf and the Name of the Font to the Registry:
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Play Regular" "Play-Regular.ttf"
Then just use the registerFont Function of the fonts-Plugin:
fonts::registerFont "Play-Regular.ttf"
Hope this helps
Greeting from Munich
HeG
Edit: Corrected the Call of the shell32
Anders
11th December 2012 15:17 UTC
Don't mix t type and A/W suffix. b is not a type, Windows uses int for BOOL:
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT,t.r1,i ${CSIDL_FONTS},i 0) i.r0'
sols_HeG
11th December 2012 15:44 UTC
OOOk...
just saw my fault....
anyway, I hope that the correct part of my script will work ;)
I'll correct my previous post, just as I correct my script at work.
Greetings from Munich
HeG