Archive: problem installing font using register font


problem installing font using register font
Hi all,

I'm having an issue with registering a font using the register font plugin. I've included both FontName.nsh and FontRegAdv.nsh and am trying to register a few .otf fonts using InstallTTF macro.

Here is the code snippet

====================================================
; install fonts
SetOutPath $FONTS
StrCpy $FONT_DIR $FONTS

!insertmacro InstallTTF "${SUPPORTDIR}\Fonts\Frutiger-Black.otf"
!insertmacro InstallTTF "${SUPPORTDIR}\Fonts\Frutiger-BlackCn.otf"
!insertmacro InstallTTF "${SUPPORTDIR}\Fonts\Frutiger-BlackItalic.otf"

SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
====================================================

Everything compiles okay, but when I run the installer, when it gets to InstallTTF, I get a 'Wrong Font Version' error for each font I'm trying to install, followed with an 'invalid handle 32' error after that. I see the fonts in the windows fonts folder, but they're not registered.

I'm wondering if this has to do with me using .otf files and not .ttf fonts, or if it's something else that I'm doing wrong.

Thanks for the assistance.


I'd guess the fontname plug-in doesn't support OpenType fonts and only TrueType fonts. Maybe it could use a little work up.


Originally posted by kichik
I'd guess the fontname plug-in doesn't support OpenType fonts and only TrueType fonts. Maybe it could use a little work up.
Yeah that is what I guessed as well.

I'll try another route then. Thanks for the assistance. :D

So I gave the fonts.dll plugin you wrote a long time ago a shot (I dug it up out of this forum). That seemed to have done the trick. So I think I'll stick with that route.

Thanks again :p.


Originally posted by minosha1212
So I gave the fonts.dll plugin you wrote a long time ago a shot (I dug it up out of this forum). That seemed to have done the trick. So I think I'll stick with that route.

Thanks again :p.
I am tackling the same problem, I was going to use InstallFONFont instead and see if that would work, but it requires two parameters. When I look at the script here, I don't see what the second parameter is needed for, because it looks like it is never used:
http://nsis.sourceforge.net/Register_Fonts

This seems to work. I don't know what is expected for font name, but I just used the filename minus the extension. If anyone sees a potential side effect of this let me know. I tried reading the code for InstallFONFont, but like I said, it looks like the second parameter is never used.

!insertmacro InstallFONFont '${FontsSourcePath}\Common\Special\Fonts\texgyreheros-bold.otf' texgyreheros-bold