Archive: how to install fonts


how to install fonts
Hi!
How do I install fonts with NSIS?
Is there a built-in function or I have to use
a special plugin?
I did not find anything on this in the docs.


I think you just need to extract the fonts to $WINDIR\fonts then do a reboot.

-Stu


Originally posted by Afrow UK
I think you just need to extract the fonts to $WINDIR\fonts then do a reboot.

-Stu
That's what I did, and to avoid the reboot I would exec $windir\fonts,
so that an explorer window launches and the system refreshes the fontlist, but I was looking for a more elegant way to do this without a reboot.

Take a look at this thread: http://forums.winamp.com/showthread....341#post976341


That topic brings back memories!

-Stu :D


Originally posted by Afrow UK
That topic brings back memories!

-Stu :D
Thanks for pointing me in the right direction.
So far, beside using the fonts.dll plugin the best
way I have found to register fonts without a plugin is
this piece of code:


!include WinMessages.nsh
System::Call "GDI32::AddFontResourceA(t) i ('IPAFONT.TTF') .s"
Pop $0
# $0 is zero if the function failed
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0


It works.
The question is: Would it be Ok to use wildcards with this command or
I have to write one command per font?

AddFontResource doesn't support wildcards. You can use FindFirst, FindNext and FindClose to find all of the files matching the criteria and call AddFontResource on each one of the results.