|
|
#1 |
|
Junior Member
|
Hi!
Ok, I create an installer that include a font. I install font to target machine. But! The font is not "registered(?)" in Windows automatically. I have to manually open and close Fonts Dir with Control Panel. What can I do to install a font and "register" it with Windows automagically? Sorry for my english, I speak only Italiano (and not so very well). |
|
|
|
|
|
#2 |
|
Forum King
|
i'm not 100% sure since i didn't test it, but try the following (i used example Time New Roman):
Windows NT/2000/XP code: Windows 95/98/ME code: you can use the GetWindowsVersion function (see NSIS\functions.htm) to determine the windows version. hope it works, let us know
|
|
|
|
|
|
#3 |
|
Junior Member
|
Yes, yes. It works!!!
Thank you. After writing keys in registry, I need to reboot machine. After, I find all fonts ready for applications!!! Thank you! |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
There is a way of doing this without requiring a reboot.
This way involves Windows' API calls so you will need an external DLL or EXE. First you need to call AddFontResource(lpszFilename) with the font's file name (for example: AddFontResource("TIMES.TTF"). Next you need to broadcast a message so all of the runnint applications will reload the system font table. To do so, you should use PostMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0). If you need any help writing the DLL/EXE let me know. KiCHiK EDIT: If you are building an uninstaller too you will need to use RemoveFontResource(lpszFilename), and manually delete the registry entry. You will also need to send another WM_FONTCHANGE message. |
|
|
|
|
|
#5 |
|
Junior Member
|
Font
I need a DLL to call AddFontResource("TIMES.TTF") and PostMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0).Ok. I can use some NSIS function to do the same thing? Sorry, but I have no idea on writing a DLL making this...
|
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Don't worry, be happy
![]() Attached is the DLL + source. To use it in your installation add the following code: PHP Code:
PHP Code:
KiCHiK |
|
|
|
|
|
#7 |
|
Member
Join Date: Apr 2001
Posts: 73
|
Kichik,
Your code and dll works great, but how do you make it register more than one font? Will this work?: GetTempFileName $R0 File /oname=$R0 fonts.dll ; Change this line to your real font name. ; If it is not in the default Windows' directory write it's full path! Push "Font1.TTF" CallInstDLL $R0 registerFont Push "Font2.TTF" CallInstDLL $R0 registerFont Push "Font3.TTF" CallInstDLL $R0 registerFont Push "Font4.TTF" CallInstDLL $R0 registerFont |
|
|
|
|
|
#8 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Your code should work just fine.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#9 |
|
Forum King
|
did not work in nsis 2.0 alpha
|
|
|
|
|
|
#10 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Could you be a little bit more specific please?
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius Last edited by kichik; 10th July 2002 at 21:04. |
|
|
|
|
|
#11 |
|
Guest
Posts: n/a
|
Just to remind you: NSIS 2.0a0 is not free of bugs! The latest supported and official version is NSIS 1.98. I suggest that you use that one for compiling your scripts.
-Hendri. |
|
|
|
#12 |
|
Junior Member
Join Date: Jul 2002
Posts: 14
|
I followed all the instructions above, but when I run the installer, this happens:
rosInst.exe - Bad Image The application or DLL G:\Documen~1\Markri~Locals~1\Tempnst964.tmp is not a valid Windows image. Please check this against your installation disk. my script file is attached. Any help would be most appreciated. [edit] I'm on an XP Pro system. |
|
|
|
|
|
#13 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Are you using using about NSIS 2 or 1.98/9?
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Jul 2002
Posts: 14
|
I used both 1.96 and now 1.98.
|
|
|
|
|
|
#15 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Please try the attached script and tell me which messages you get.
Don't forget to change the file extension to .nsi. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#16 | |||
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
Quote:
Quote:
You should SetOverwrite On before the File command. Quote:
|
|||
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Jul 2002
Posts: 14
|
Thanks to both of you, but only Joost's fix worked. Thanks again, no more restarts after my installer, YAY!
|
|
|
|
|
|
#18 |
|
Forum King
|
i had no errors during the compilation, but it just didnt install or copy the fonts. maybe i am stupid, could you please paste some code doing this with a common windows font, so it will work in my code only copy+pasted? pleeease
|
|
|
|
|
|
#19 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
All of the code you need to copy+paste it up there
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#20 |
|
Junior Member
Join Date: Jul 2002
Posts: 14
|
Attached is my .nsi file (.zipped since you can't upload .nsi files), it appears to work perfectly for both 9x based and NT based systems. Hopefully you can follow it.
|
|
|
|
|
|
#21 |
|
Forum King
|
can i use the same .dll to uninstall the font again? it would surely be better -even for testing purposes- to remove the font everytime for the system i'm testing on. so far i had to send all installers to friends, which consumes quite some time. uninstalling would be a great help!
|
|
|
|
|
|
#22 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
You can use the same DLL for uninstalling... Please check the code above...
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#23 |
|
Forum King
|
is it necessary to use that .dll for old .fon fonts, or can i just copy them without registering them?
|
|
|
|
|
|
#24 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
As far as I know you should register them too.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#25 |
|
Major Dude
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
|
Reminder
Just a little reminder that since NSIS 2.0a4 you can make this kinda thing:-
PHP Code:
PHP Code:
|
|
|
|
|
|
#26 |
|
Forum King
|
Sorry to bring up and old topic, but...
I'm still not clear on how to register a font without rebooting...
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#27 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Put Fonts.dll in your Plugins directory.
After you copy the font over and write the registry entries, just call Fonts::registerFont "FontName" If you have installed the font in the Windows font folder, just use its name (times.ttf for example), if not use its full path ($INSTDIR\times.ttf for example). That's it, the font is then registered, and you don't need a reboot. For the uninstaller, remove the registry entries, call Fonts::unregisterFont "FontName" and delete the font. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#28 |
|
Forum King
|
I can't find Fonts.dll, is fontreg.exe the same thing? It seems to work okay compiling...
fyi I'm running Win98 SE. Am I right in assuming that I need to put the GetWindowsVersion function at the top of the script, and use something along the lines of ParalaxTZ's script: PHP Code:
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#29 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Never heard of font reg... A zip file containing fonts.dll is attached above in one of my posts...
To add the registry writing you must call GetWindowsVersion (find it in the useful functions section in the docs), Pop and compare like in the script you just wrote. Then call registerFont like I said in the earlier post. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#30 |
|
Forum King
|
Thanx, didn't see that.
Now I'm getting an error message: WriteRegStr: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Adolescense=Adolesce.TTF WriteRegStr: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts\Adolescense=Adolesce.TTF Invalid command: fonts::registerfont Error in script "C:\NSIS\tff2.0\custom.nsi" on line 229 -- aborting creation process This is the end of my script: PHP Code:
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#31 | |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Quote:
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
|
#32 |
|
Forum King
|
Oops. I thought you were talking about the Winamp plugins directory
![]() But I'm still getting the same error message. Is this code wrong? SetOutPath "$WINDIR\system32\" File "c:\nsis\plugins\Fonts.dll" "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#33 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
First, make sure you got the latest NSIS 2 version, beta 0. You can download it from http://prdownloads.sourceforge.net/n....exe?download.
Now copy fonts.dll to the Plugins dir of NSIS (that is a directory on the system where NSIS is installed). Usually the path is C:\Program Files\NSIS\Plugins. NSIS will detect your plugin and you can use fonts::registerFont in your NSIS script. NSIS handles the extracting, deleting etc. of the file. There is nothing else where you have to worry about. |
|
|
|
|
|
#34 |
|
Forum King
|
I have the latest NSIS2. I'm still getting an error message when I compile that says fonts::registerfont is an invalid function.
I'll try rebooting... "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#35 |
|
Forum King
|
Didn't work. Where does the DLL have to be in relation to the .NSI file, and where does the .NSI file have to be in relation to the NSIS installation path?
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#36 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
The DLL should be copied to the NSIS Plugins directory of YOUR system. That is the subdirectory 'Plugins' in the directory of the NSIS installation. You don't have to worry about extracting it on the user's system, NSIS does everything for you.
At the beginning of the NSIS compiler output, you can see a list of all detected plugins. |
|
|
|
|
|
#37 |
|
Forum King
|
Okay, so it doesn't matter where the .NSI file is, I take it...?
I'm gonna post my script here. I'm also having troubles with the instdir page not having the default path... "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#38 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
That's not a NSIS 2.0b0 script, it has .onNextPage and .onPrevPage in it. If you are sure it is supposed to work with b0 notify Jheriko that it is highly out of date.
When you compile the script do you see on the top of the output after the credits stuff a list that starts with: Processing plugin dlls: "<nsis dir>\plugins\*.dll" ? If you don't see that line and a list after it you are not using NSIS 2.0b0. If you do, do you see fonts::registerFont there? If it is there, try copying the line exactly as it is and paste into the script, then see if you get errors (don't forget to add the font name if it works). If there is a list and fonts::registerFont is not there you didn't put fonts.dll in the right directory (use !error "${NSISDIR}\Plugins" in any script to see what it is). NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#39 |
|
Forum King
|
Ooookay...I'm gonna tell Jheriko that, after I smack the fuckin shit out of him.
The script compiles to fast for me to read anything at the top, so I wouldn't know Anyway, thanx, sorry for all the trouble
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
|
|
|
|
|
#40 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Aren't you using MakeNSISw? It's a windows wrapper for NSIS that comes with NSIS. Just right click a script and choose Compile NSI. If you still get a DOS box you are not using NSIS 2 for sure.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|