【问题标题】:How to install Open Type Fonts using Wix如何使用 Wix 安装 Open Type 字体
【发布时间】:2018-06-28 16:26:17
【问题描述】:

我想在安装 MSI 时安装一组 Open Type 字体。我正在使用 Wix 创建 MSI。

有什么建议吗?

【问题讨论】:

    标签: fonts installation wix


    【解决方案1】:

    需要指定目录FontsFolder,并在文件上设置TrueType属性:

    <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>
    

    【讨论】:

    • 如果系统上已经存在字体,如何告诉 WiX 忽略安装字体?
    • @essamSALAH:如果您将每个文件放在单独的组件中,那么该文件将充当组件的键路径。如果组件的 keypath 已经存在,则不会安装组件。
    • 似乎缺少某些东西。这是我尝试此操作时遇到的错误:error LGHT0094 : Unresolved reference to symbol 'Directory:FontsFolder',我还缺少什么吗?
    【解决方案2】:

    对于安装字体,您必须在代码中设置两个部分:

      <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>
    

    【讨论】:

      【解决方案3】:

      我无法弄清楚DirectoryRef——也许这些年来有些事情发生了变化——但我在我的根目录TARGETDIR 中添加了一个Directory 并让它工作。就我而言,我需要在服务器上使用 Arial Narrow Bold:

      <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>
      

      【讨论】:

      • 如果您不将目录设置为FontsFolder,则会导致问题。它可以嵌套在任何目录中。它实际上并没有创建/安装到那个文件夹,它是一个特殊的文件夹。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      • 2018-05-27
      • 2021-02-06
      • 2011-10-29
      • 2015-12-26
      相关资源
      最近更新 更多