Archive: Installing a Font - Help!!


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.


any help at all folks? I'm at a loss here :cry:


thankfully I've managed to sort this myself...I'd be a long time waiting for it here.


You're welcome for nothing. :D


Hi, I'm having exactly the same problem here.

gdollard, do you remember how did you solve it?

Thanks!


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.


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.

Timeout=1 seems a little short IMHO...


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


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'

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