Archive: InstallTTF with Unicode NSIS??


InstallTTF with Unicode NSIS??
Hi,

I'm trying to install .ttf fonts while installing, so using "InstallTTF" from FontRegAdv.nsh.

It works well with ANSI NSIS, but not with Unicode NSIS - I've used the same script without any change for both version.

No errors raised when compiling scripts, but the installer made by Unicode NSIS just crashes while installing .ttf fonts on Win7 or Vista.

Please help me if you have any idea about this issue.


The constants, plug-ins are all developed for ANSI version. If you want to register a font file to Windows' Fonts directory, the easiest way is using AddFontResource function.

SetOutPath $FONTS
File .\fonts\XXX.ttf #example path
System::Call `gdi32::AddFontResource(t)i("$FONTS\XXX.ttf").R0`
${If} $R0 > 0
MessageBox MB_OK "Font have been installed successfully!"
${Else}
MessageBox MB_OK "Font installation fails!"
${EndIf}

The registry values for font would be also added automatically. But, if you are installing a font to custom folder, but not the Windows' Fonts, you can use an funciton to get the font name first, and then you must write the registry manually.
See this thread: http://forums.winamp.com/showthread.php?t=319648