wpf使用truetype字体ttf

查了半天都是语焉不详,这篇算是稍微详细点的:http://www.cnblogs.com/junhengml/p/6878933.html

要先查找到字体的字库名称,才能使用:

    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Width" Value="46"/>
            <Setter Property="Height" Value="89"/>
            <Setter Property="FontSize" Value="48"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="TextElement.FontFamily" Value="Resources/#LcdD"/>
        </Style>
        
    </Window.Resources>

 LcdD 是字库的名称,这点得弄清楚。

原文地址:https://www.cnblogs.com/macleo/p/7502935.html