This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Proper way to install fonts (InstallScript)...
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 15, 2010
01:54 PM
Proper way to install fonts (InstallScript)...
Currently I'm using 'AddFontResource' and manually installing fonts to the registry. For whatever reason one of the fonts is now not printing. This may have to do with the embedding restrictions and we are looking into this but that aside what are we actually supposed to use in order to properly install a font on a user's system. In our old installer which was converted up from InstallShield 6 (which I later learned you can't really do because certain features that weren't in 6 and would be missing in the up-conversion...) these fonts printed correctly in XP, Vista, and Win7. Now after building the installer from the ground up in 2010, this font will NOT print at all. If we change the font to ANYTHING else it will print.
This is a sample of my code:
Searching the interwebs I found 'RegisterFontResource' and 'RemoveFontResource'. Are we now supposed to be using those methods or is my current code above still 100% valid here? Or is there some other way to correctly install (again using InstallScript so MSI options won't work here)?
I'm going to test these other methods to see what happens but it won't explain the why or how...
This is a sample of my code:
function RegisterFonts()
.
.
.
begin
//--- Initialize KEY
szKey ="SOFTWARE\\MICROSOFT\\WINDOWS";
//--- Determine Operating System
GetSystemInfo ( OS , nResult , svResult );
if(nResult = IS_WINDOWSNT) then
szKey = szKey+" NT";
endif;
szKey = szKey+"\\CURRENTVERSION\\FONTS";
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
//--- Make Registry entries
//--- SampleFont.TTF
RegDBSetKeyValueEx(szKey,"Sample FOnt (TrueType)", REGDB_STRING, "SampleFont.TTF",-1);
//--- Add these fonts to the system font table
szFontName = SampleFont.TTF;
nResult = RemoveFontResourceA(szFontName);
nResult = AddFontResourceA(szFontName)
end;
Searching the interwebs I found 'RegisterFontResource' and 'RemoveFontResource'. Are we now supposed to be using those methods or is my current code above still 100% valid here? Or is there some other way to correctly install (again using InstallScript so MSI options won't work here)?
I'm going to test these other methods to see what happens but it won't explain the why or how...
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2011
09:57 AM
In my case I found that I could add fonts and they would install just fine on 32 bit windows if I just:
Opened the Application Data/Files and Folders view
Then expanded the Windows folder in the Destination computer's folders panel
The click on the Fonts folder
Then add the ttf fonts that I want to install.
This creates a new component containing the font files, they get deployed to the Windows\Fonts folder and on 32 bit systems it works (XP, Win7).
My problem is with Win7 64 bit (didn't try XP 64). The ttf files are deployed to Windows\Fonts folder but the fonts themselves don't appear to be registered.
I'm not sure what else needs to be done here to get the fonts installed on 64 bit machines.
Richard
Opened the Application Data/Files and Folders view
Then expanded the Windows folder in the Destination computer's folders panel
The click on the Fonts folder
Then add the ttf fonts that I want to install.
This creates a new component containing the font files, they get deployed to the Windows\Fonts folder and on 32 bit systems it works (XP, Win7).
My problem is with Win7 64 bit (didn't try XP 64). The ttf files are deployed to Windows\Fonts folder but the fonts themselves don't appear to be registered.
I'm not sure what else needs to be done here to get the fonts installed on 64 bit machines.
Richard
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2011
10:21 AM
Wow totally forgot about this post...
I have to manually add them because we use certain files (that we paid for) because of the rights and if a user has a newer version it may not be compatible with the print engine(s) we use. Which is what happened in my case here. The font being used was being basically rejected outright by the print engine (of the printer not the Windows rendering/print drivers). So my fonts were/are being installed correctly using the code I posted before. Since it uses the registry to install the fonts not letting the MSI engine do this.
Again I can't use some (or most) of the advanced features of InstallShield. So try doing it manually (using my posted code) and see if that works out better. In the Feature/Component destination I just did what you did with looking for the font folder under windows. There is a register setting in the components/features area for fonts if I remember correctly. I believe the
Or try this from someone else's similar post: InstallShield Help Library topic Creating Installations > Organizing Files for Your Installation > Using Components > Installing Fonts.
(I've just re-confirmed on a 64bit machine that this posted works at installing fonts.)
I have to manually add them because we use certain files (that we paid for) because of the rights and if a user has a newer version it may not be compatible with the print engine(s) we use. Which is what happened in my case here. The font being used was being basically rejected outright by the print engine (of the printer not the Windows rendering/print drivers). So my fonts were/are being installed correctly using the code I posted before. Since it uses the registry to install the fonts not letting the MSI engine do this.
Again I can't use some (or most) of the advanced features of InstallShield. So try doing it manually (using my posted code) and see if that works out better. In the Feature/Component destination I just did what you did with looking for the font folder under windows. There is a register setting in the components/features area for fonts if I remember correctly. I believe the
Or try this from someone else's similar post: InstallShield Help Library topic Creating Installations > Organizing Files for Your Installation > Using Components > Installing Fonts.
(I've just re-confirmed on a 64bit machine that this posted works at installing fonts.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2011
12:04 PM
You are a genius!
I took your advice.
I created a component containing the .ttf font files to deploy, just as I had before. The Destination property for this component is. Important note to others here, I used the Files and Folders view to drop files into the Windows\Fonts destination. This also creates entries in the Fonts table.
Next I created a registry set for the fonts in the component and associated the set with the fonts component. It was simply a matter of creating the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts key and then dragging the correct font entries from the source computer's registry into the Destination computer's registry data for the key.
Next I added code for the DefaultFeature_Installed event adapted as follows.
//-------------------------------------------------------------------------
// The Installed event is sent after the feature DefaultFeature
// is installed.
//-------------------------------------------------------------------------
export prototype DefaultFeature_Installed();
function DefaultFeature_Installed()
string szFontName;
number nResult;
begin
szFontName = "SAMPLE.TTF";
nResult = RemoveFontResource(szFontName);
nResult = AddFontResource(szFontName);
... Other fonts added the same way ...
end;
That is all it took! It works in both the 32 and 64 bit installations.
Thanks - Richard
I took your advice.
I created a component containing the .ttf font files to deploy, just as I had before. The Destination property for this component is
Next I created a registry set for the fonts in the component and associated the set with the fonts component. It was simply a matter of creating the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts key and then dragging the correct font entries from the source computer's registry into the Destination computer's registry data for the key.
Next I added code for the DefaultFeature_Installed event adapted as follows.
//-------------------------------------------------------------------------
// The Installed event is sent after the feature DefaultFeature
// is installed.
//-------------------------------------------------------------------------
export prototype DefaultFeature_Installed();
function DefaultFeature_Installed()
string szFontName;
number nResult;
begin
szFontName = "SAMPLE.TTF";
nResult = RemoveFontResource(szFontName);
nResult = AddFontResource(szFontName);
... Other fonts added the same way ...
end;
That is all it took! It works in both the 32 and 64 bit installations.
Thanks - Richard