Vytautas
7th November 2003 04:29 UTC
Strange Font Installation Problem
When I use the following macro to install a font file it copies the file OK but the font does not appear in any font lists even after the PC is restarted. However if you open the Windows Fonts folder in Explorer all of the font are availabble to the programs.
I'm cannot be certain if this script did work previously and this is just a incompatibility with the newer version of NSIS or if it always behaved in this manner.
!macro InstallFont FontNAME Index
SetOutPath $FONT_DIR
IfFileExists "$FONT_DIR\${FontName}" ${Index}
File '${FontName}'
System::Call "GDI32::AddFontResourceA(t) i ('${FontName}') .s"
${Index}:
!macroend
Vytautas
cchian
7th November 2003 05:35 UTC
Try adding this line after you add the font (code by kichik):
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0
Vytautas
7th November 2003 05:46 UTC
Do I need to add this line after every font is added, cos I already have this line after all of the fonts are installed, I insert this macro several times in one of the sections and I have that line after the last line.
Vytautas
cchian
7th November 2003 05:52 UTC
I believe you only need this line once.
Vytautas
7th November 2003 06:00 UTC
In that case thats not the problem. I know that this problem exists in Win98SE and I also suspect in WinXP, will confirm later tonight.
Vytautas
kichik
7th November 2003 08:09 UTC
You also have to create a certain registry key. Search the forum for the original thread where the AddFontResourceA function first brought up, it's there. It would be nice if you can merge it all together into one archive page.
Vytautas
7th November 2003 08:41 UTC
Thanks, modified my macro. Will test and create an Archive page if OK.
Vytautas
Vytautas
7th November 2003 11:23 UTC
Archive page created. Thanks guys for helping me to solve this problem.
Vytautas :D