matthias_k
3rd June 2003 16:57 UTC
Registering fonts with Windows...
Hey there,
I need to register some fonts distributed along with my program.
The problem is that the registry key where the font strings are located differs between Win NT based Windows versions and Win9x based Windows versions.
I searched the archive to find a solution and found a tutorial on how to retrieve the current Windows version.
Well that's fine, but I would need to write syntax like:
if( version == win_nt ) { do this; }
else { do that; }
AFAIK there IS no equivalent to the if-statement in NSIS scripting language, so how can I switch a statement?
Joost Verburg
3rd June 2003 17:22 UTC
There is.
Example:
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $R0 "" 0 winnt
...code for Windows 9x...
Goto done
winnt:
...code for Windows NT...
done:
Another topic about registering fonts (with a plug-in):
http://forums.winamp.com/showthread.php?threadid=79586
kichik
3rd June 2003 18:46 UTC
Instead of the plug-in you can use this code to register fonts:
!include WinMessages.nsh
System::Call "GDI32::AddFontResourceA(t) i ('fontname.fon') .s"
Pop $0
# $0 is zero if the function failed
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0
and to remove:
!include WinMessages.nsh
System::Call "GDI32::RemoveFontResourceA(t) i ('fontname.fon') .s"
Pop $0
# $0 is zero if the function failed
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0
Afrow UK
3rd June 2003 19:26 UTC
Hi Matt
I'm guessing that's the D-Day Matthias?
-Stu :)
matthias_k
3rd June 2003 20:02 UTC
Thanks for your replies.
Hi Matt
I'm guessing that's the D-Day Matthias?
Sorry, no. I'm probably just another Matthias :)
Afrow UK
3rd June 2003 20:33 UTC
Originally posted by matthias_k
Thanks for your replies.
Sorry, no. I'm probably just another Matthias :)
Woh cool.
I just referred another Matthias to NSIS and I thought he was you - he's around here somewhere :)
Good luck with NSIS!
NSIS rocks!
I'm drunk :)
-Stu
matthias_k
3rd June 2003 21:14 UTC
NSIS rocks!
Hell yeah it does! The best installer I've seen so far.
Kudos to the guys from NullSoft.