- NSIS Discussion
- Looking for a Font installation example
Archive: Looking for a Font installation example
Cecilio
5th March 2004 16:58 UTC
Looking for a Font installation example
Could any one give me an example of installing a font using the Vytautas scripts FontName.nsh & FontReg.nsh ?
I'm trying this code:
InstalarFont:
ClearErrors
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont '..\Fonts\LeMusNot.ttf'
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
IfErrors +1 FinInstalarFont
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(ERROR_InstalarFont) IDRETRY InstalarFont
MessageBox MB_YESNO|MB_ICONQUESTION $(MSG_CONTINUE) IDYES +2
Abort "$(MSG_ABORT)"
FinInstalarFont:
But I'm getting errors in compilation. Any suggestion?
Thank you very much
Cecilio
6th March 2004 16:31 UTC
Yes, thank you. I did checked both pages. In fact I took the macros from there. But I am having problems using them and I do not know how to continue.
My problem is that in compilation, I get the following messages:
[SMALL]!insertmacro: InstallTTFFont
Push: $R0
Push: $R1
Push: $R2
!define: "Index"="Line215.5"
SetOutPath: "$FONT_DIR"
IfFileExists: "$FONT_DIR\..\Fonts\LeMusNot.ttf" ? Line215.5 :
File: "LeMusNot.ttf" 17192 bytes
ReadRegStr $R0 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion
IfErrors ?Line215.5-9x:Line215.5-NT
StrCpy $R1 "Software\Microsoft\Windows NT\CurrentVersion\Fonts" () ()
Goto: Line215.5-GO
StrCpy $R1 "Software\Microsoft\Windows\CurrentVersion\Fonts" () ()
Goto: Line215.5-GO
ClearErrors
!insertmacro: FontName
Push: $FONT_DIR\..\Fonts\LeMusNot.ttf
Call "TranslateFontName"
Invalid command: FontName::Name
Error in macro FontName on macroline 3
Error in macro InstallTTFFont on macroline 25
Error in script "C:\LenMus\LenMus\Instalacion\Instalar.nsi" on line 215 -- aborting creation process
[/SMALL]
And I don't know how to debug this. Line 3 of macro FontName is this:
Fontname::Name
I supose it is a call to the Name function in FontName.dll plugin but I do not know either how to continue nor what to do. Thas's why I was trying to find a full example, to try to find differences from my code.
Thank you anyway.
kichik
6th March 2004 18:51 UTC
Put the FontName plug-in in the Plugins directory.
Cecilio
6th March 2004 20:45 UTC
Thank you very much. But I already did put the file FontName.dll in the plugins directory. Should I put any thing else there or do something to register this dll?
Also there are two includes in my source file:
!include "FontReg.nsh"
!include "FontName.nsh"
Both files are in the NSIS\include directory
Thank you.
Joost Verburg
6th March 2004 21:51 UTC
You can also use the code in this topic (standard System plug-in):
http://forums.winamp.com/showthread....=register+font
kichik
6th March 2004 22:04 UTC
If "FontName::Name" is an invalid command you've put it in the wrong place or put the wrong file. Put FontName.dll in the Plugins directory where NSISdl.dll, System.dll and BgImage.dll are. Make sure it is named FontName.dll.
Cecilio
7th March 2004 12:18 UTC
Thank you very much for your answers.
To Joost Verburg: I tested the code taken from an example found in the forum. The example was named "main menu.nsi" (Sorry, I can't find the page from where I downloaded it). It works OK.
But I was looking for a more modular and robust solution that could be maintained in the future as part of the NSIS core. That's why I was trying to use the Vytautas macros.
Thank you anyway for your suggestion. And thank you very much for MUI and all your good work.
To kichik: The dll is in the right place. I will download a new version of the dll and re-check everything. I will tell you later. Thank you very much for your help.
Cecilio
7th March 2004 12:42 UTC
I downloaded again the FontName plugin (version 0.6) and re-checked. The same problem. By the way, I sent to Vitautas the spanish translation to be incorporated to the macro. Here it is just in case any one needs it:
StrCmp $LANGUAGE 1034 0 End-1034 ; Spanish (traditional)
Push "Versión del font incorrecta"
Push "Error de dirección de archivo mapeado: %u"
Push "Error de archivo mapeado: %u"
Push "Tamaño de archivo erroneo: %u"
Push "Manipulador de archivo erroneo: %u"
Push "Plugin de NSIS para FontName %s "
goto ${Index}
End-1034:
Joost Verburg
7th March 2004 12:44 UTC
Is the FontName plug-in listed in the compiler output (at the beginning)?
You can also put the other code that uses the System plug-in in a macro.
Cecilio
7th March 2004 13:58 UTC
Yes, but they appears as follows:
...
- Dialer::AutodialUnattended
- Dialer::GetConnectedState
- VPatch::vpatchfile
- FontName.DLL::name
- FontName.DLL::version
umh! is it right to be "FontNAme.DLL::name" instead of "FontName::Name?
Cecilio
7th March 2004 14:42 UTC
The cause of the problem is found. The FonName-0.6.exe installer installs the "FontName.dll" as "FontName.DLL" (upper case extention). Somehow the extention ".DLL" is not interpreted correctly and it is assumed the name "FontName.DLL.dll". Changing the extention to lower case ".dll" fixes "my" problem (not the deeper problem).
Thank you very very much for all your help. I appreciate it very much.
I will send a message to Vytatutas to keep him informed about all this.
Thank you everybody again. Kind regards.
Vytautas
8th March 2004 03:13 UTC
Thanks cecilio for spotting that error. I will upload the fix installer later today, don't have the files on this PC. :) Also I will include the Spanish tyranslation you provided in the PM.
Although I think it would be a good idea to fix this plugin detection error in NSIS code as well. ;)
Vytautas
kichik
11th March 2004 19:33 UTC
Fixed in latest CVS version.