Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a font with Wix not to the local font folder

Tags:

fonts

wix

I am using Wix to create an installation for a website.

When adding a font, WiX picks up on the .ttf extension and requires you to install it to the local Font folder (When using a Directory Id="FontsFolder" and TrueType="yes"). If you remove these attributes, it falls over.

Is there a way to get WiX to install the fonts to a custom folder (../Content/fonts/) without complaining?

EDIT:

   <Directory Id="dirFontsFolder" Name="fonts">
       <Component Id="cfont.ttf" Guid="BDEBACC8-D057-4406-87B9-B310BA6DFE27">
           <File Id="font.ttf" Source="$(var.SrcWebsite)\Content\fonts\font.ttf" KeyPath="yes" />
       </Component>
   </Directory>

With the above code, I get the error:

error LGHT1076 : ICE60: The file font.ttf is not a Font, and its version is not a companion file reference. It should have a language specified in the Language column.

like image 219
Kyzou Avatar asked Oct 24 '12 15:10

Kyzou


People also ask

How do I manually install a font?

Right-click the fonts you want, and click Install. If you're prompted to allow the program to make changes to your computer, and if you trust the source of the font, click Yes. Your new fonts will appear in the fonts list in Word.


2 Answers

After the issue being raised months later we managed to find the issue:

The KeyPath solution was half of the answer (See Alex's Answer). Without using the KeyPath attribute in WiX, the below solution will not work.

The other part is the Internal Consistency Evaluators (ICE) that WiX runs through Linker (light.exe) when packaging the MSI. The ICE rule ICE07, checks the contents of the files, and if it determines that the file is a font, will force the file in Windows/Fonts.

To stop this happening, you need to disable this rule when light.exe runs. To do this, you add the -sice: parameter after light.exe. For our example it would be:

light.exe -sice:ICE07

You can disable multiple rules by adding more -sice parameters.

like image 178
Kyzou Avatar answered Sep 17 '22 20:09

Kyzou


You can acheive the same thing with VS:

Right Click on the Setup Project, click on Properties.

Select the Tool settings Tab.

In the ICE validation section, you can suppress all warnings, or a specific one ICEXX, in this case

[ICE60]

OR

On the same TAB (Tool Settings), you can add additional parameters to the compiler or the linker. So, in the linker section just add

[-sice:ICE60]

like image 39
CheGueVerra Avatar answered Sep 19 '22 20:09

CheGueVerra