Skip to content
⌘ NSIS Forum Archive

how to install fonts

7 posts

human-0-id#

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.
human-0-id#
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.
human-0-id#
Originally posted by Afrow UK
That topic brings back memories!

-Stu 😁
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?
kichik#
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.