18

I want to install a set of Open Type Fonts as part of my MSI installation. I am using Wix to create the MSI.

Any advice?

cbuchart
  • 10,847
  • 9
  • 53
  • 93
essamSALAH
  • 641
  • 2
  • 8
  • 15

3 Answers3

21

You need to specify the directory FontsFolder, and set the TrueType attribute on the file:

<DirectoryRef Id="FontsFolder">
  <Component Id="MyFontsFonts" Guid="...">
    <File Id="font1.ttf" Source="font1.ttf" TrueType="yes" />
    <File Id="font2.ttf" Source="font2.ttf" TrueType="yes" />
  </Component>
</DirectoryRef>
Zachary Yates
  • 12,966
  • 7
  • 55
  • 87
marklam
  • 5,346
  • 1
  • 24
  • 26
  • How can tell WiX to ignore installing the fonts if they are already exist on the system ? – essamSALAH Jun 29 '09 at 09:51
  • 5
    @essamSALAH: if you put each file in a separate component, then the file will act as the keypath of the component. A component will not be installed if its keypath is already present. – Wim Coenen Feb 07 '11 at 22:53
  • 4
    It seems something might be missing. Here's the error I have when I try this: `error LGHT0094 : Unresolved reference to symbol 'Directory:FontsFolder'`, is there something else I'm missing? – Christian Rondeau Mar 06 '15 at 20:24
4

For install fonts you must set two parts in your codes:

  <Feature Id="ProductFeature" Title="WixSetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="ApplicationShortcut" />
      <ComponentRef Id="ApplicationShortcutDesktop" />
      <ComponentRef Id="MyFontsFonts" />
  </Feature> 
.
.
.

<Directory Id="TARGETDIR" Name="SourceDir">                  
.
.
.
   <Directory Id="FontsFolder">
        <Component Id="MyFontsFonts" Guid="myGuid">
           <File Id="font1.ttf" Source="Fonts\font1.ttf" TrueType="yes" />
        </Component>
   </Directory>

</Directory>
AliOsat Mostafavi
  • 363
  • 1
  • 5
  • 13
2

I couldn't figure out DirectoryRef—maybe something has changed over the years—but I plopped a Directory in my root TARGETDIR and got it to work. In my case, I needed Arial Narrow Bold on the server:

<Directory Id="TARGETDIR" Name="SourceDir">
   <!-- snip ... all my other stuff here -->
   <Directory Id="FontsFolder">
     <Component Id="ComponentFontArialNarrowBold" Guid="{65F4712A-EAA6-4801-9200-212A3593D6E2}">
       <File Id="FileFontArialNarrowBold" Source="$(var.SolutionDir)Res\Fonts\ARIALNB.TTF" TrueType="yes" KeyPath="yes" />
     </Component>
   </Directory>
</Directory>
Nicholas Piasecki
  • 25,203
  • 5
  • 80
  • 91
  • If you don't set the directory to `FontsFolder` it will cause issues. It can be nested in any directory. It doesn't actually create/install to that folder, it's a special folder. – Kelly Elton Apr 05 '19 at 04:03