我已閱讀過這樣的文章,例如31 days of windows phone day 24 embedding-fonts和這個windows 8 xaml tips custom fonts,它們可以非常清楚地解釋如何做到這一點。將自定義字體添加到Windows Phone 8應用程序
但由於某種原因,我無法弄清楚,我的自定義字體不會顯示在我的應用程序中,無論是在設計器視圖中還是在運行時。
要確保我沒有遺漏任何一步了,我展示了我在這裏做了什麼我的問題可能是任何建議:
首先,這是我的XAML代碼文本塊
<StackPanel Grid.Row="1" x:Name="BottomPanel" Height="120" Width="800" Orientation="Horizontal">
<StackPanel.Background>
<SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}"/>
</StackPanel.Background>
<TextBlock x:Name="MainTextBlock" FontFamily="/Fonts/KOMIKAX_.ttf" TextWrapping="Wrap" Text="Hello" Width="680" Height="120" Margin="10,0,0,0" FontSize="25" Padding="20,10"/>
</StackPanel>
2.我在我的項目中創建一個文件夾,把它稱爲「字體」,這是我抄我的字體文件。
3.我將字體文件的Build Action
更改爲Content
。我首先將Copy To Output Directory
財產作爲None
,然後將其更改爲Copy If Newer
。沒有成功。
我做錯了什麼,或者我漏掉了什麼?
使用文件名作爲字體家族看起來很奇怪...你打開ttf來查看字體的真實名稱嗎?通常我會使用像「。\ Fonts \ MyCustomFont.ttf#自定義字體名稱」 – Gonzix
字體的真實名稱是「Komika Axis」,但不是你應該使用文件名,而不是在' FontFamily'屬性? –