Archive: installing fonts on Vista


installing fonts on Vista
Hi all,

I'm having problems installing a font in de $FONTS directory of Windows Vista.

I use this code which works great on Windows XP

To copy the font :

SetOutPath $FONTS
File "Vet-Files.ttf"

To use the font without restarting Windows :

GetTempFileName $R0
SetOverwrite On
File /oname=$R0 fonts.dll
;SetOverwrite ifnewer

Push "Vet-Files.TTF"
CallInstDLL $R0 registerFont

I understand you can't copy files into system directories because of UAC.

I've tried the UAC.dll plugin.
I've also tried using RequestExecutionLevel user

But nothing works :(

Any help would be appreciated.


Where exactly does it fail? Does it not copy the font file at all? Does it fail registering?


It fails to copy the font in the $FONTS directory. The funny thing is that it does register the font. So my program runs normal shortly after installation, but not anymore after you restart the computer, because the font wasn't copied to the $FONTS directory.

I try to package a demo-version of a database program.
Another frustrating thing is that you can't add new items in the demo-version because Windows Vista only allows users to view the data, not update it. Unless you turn of UAC which isn't the best way to go off course.

You can see screenshots of my program on my website wwww.vet-files.com


I bet the font is actually installed under %APPDATA%\Windows\Fonts. Use RequestExecutionLevel admin and it should be able to write to C:\Windows\Fonts.


I can't find it under %APPDATA%

This is the very simple code I use :

RequestExecutionLevel admin
Name "Font"
OutFile "font.exe"

Page instfiles

Section ""

SetOutPath "C:\Windows\Fonts"
File Vet-Files.ttf

SectionEnd


I've got the latest version of NSIS (2.31) (which by the
way is a very nice program)

I don't know what i'm doing wrong.
On my Windows XP this code works perfect.

:(


Vista has some automatic file redirection when it comes to the system directory. It's usually disabled when you use RequestExecutionLevel. I don't know why it keeps redirecting in this case. Maybe if we find out where it redirects, it'll shed some light. Can you search the entire HD for vet-files.ttf?


I've searched the entire HD but can't find "vet-files.ttf" anywhere :(

(except off course in my own maps in program files)


Try running FileMon in the background to see where it actually tries to write it.


Just an idea:
It might actually copy the font in C:\Windows\Fonts correctly, but the search feature of windows scan the "Fonts" folder differently that a standard folder and search through the registered fonts rather than the actual files.
(use a DOS box to "dir" the content of this folder)

Try adding the registerFont call to your latest scripts ?


Hi Wizou,

You're right !!! I used the dos box to scan for my font and it was there ! Process Monitor already showed me that the font was copied correctly to the fonts folder.

So I changed my simple code to this :

RequestExecutionLevel admin
Name "Font"
OutFile "font.exe"

Page instfiles

Section ""

SetOutPath "C:\Windows\Fonts"
File Vet-Files.ttf

sectionEnd

Section "Font"

GetTempFileName $R0
SetOverwrite On
File /oname=$R0 fonts.dll
Push "Vet-Files.TTF"
CallInstDLL $R0 registerFont

SectionEnd

What happens is it registers the font correct, but only once. When I restart Windows, it's not registered and my font doesn't show up anymore.

Any ideas ? Is there another way to register a font in Vista ?

Thx already for all the great responses

So there must be a different code for registering the font in Vista !


I tried using the http://nsis.sourceforge.net/Register_Fonts example, and it seems to work fine in Vista after a reboot


Hi Anders,

Thx for the link you provided. I already played around with FontReg.nsh awhile ago, but couldn't get it to work back then. Now I can, so my font problem is solved !
It works perfect both under XP and Vista, even after rebooting.
Thanks alot everyone for pointing in me in the right direction.

Now there's still one big hurdle for me to overcome deploying my demo-version on Windows Vista : my demo contains a database with a backend and a frontend. The backend sits in a subfolder of $ProgramFiles\Vet-Files-Demo.
The problem is that Vista doesn't allow users to change data in the backend. I can only overcome this by letting users disable UAC on their computer, which is something I rather don't want to do. Is there a simple workaround ? Am I doing something stupid here ? I'm not really a programmer, I'm more more like a selfmade amateur ;) Any tips would be appreciated.


Give normal users write access to that folder with http://nsis.sourceforge.net/AccessControl_plug-in


Hi Anders,

Thx for the link ! Works like a charm !
All my hurdles are overcome ;) I'm gonna start burning now !
Thx everybody for the great support.