2009-05-15 41 views

Trả lời

18

Bạn cần phải xác định FontsFolder thư mục, và thiết lập các thuộc tính TrueType vào 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> 
+0

Làm thế nào có thể nói với WiX để bỏ qua cài đặt các phông chữ nếu họ đã tồn tại trên hệ thống? – essamSALAH

+5

@essamSALAH: nếu bạn đặt mỗi tệp vào một thành phần riêng biệt, thì tệp sẽ hoạt động như là đường phím của thành phần. Một thành phần sẽ không được cài đặt nếu đường phím của nó đã có mặt. –

+4

Có vẻ như một cái gì đó có thể bị thiếu. Đây là lỗi tôi có khi tôi thử điều này: 'lỗi LGHT0094: Chưa được giải quyết tham chiếu đến biểu tượng 'Thư mục: FontsFolder'', có cái gì khác tôi đang mất tích? –

2

tôi không thể tìm ra một cái gì đó DirectoryRef -maybe đã thay đổi trong những năm qua, nhưng tôi ngồi phịch một Directory trong gốc của tôi TARGETDIR và làm cho nó hoạt động. Trong trường hợp của tôi, tôi cần Arial Narrow Bold trên máy chủ:

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

Đối với cài đặt phông chữ bạn phải thiết lập hai phần trong mã của bạn:

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

Điều kỳ diệu đã làm cho tôi, cảm ơn! – RugerSR9

Các vấn đề liên quan