首页 > 解决方案 > WPF - 是否有将字体粗细应用于 Arrial 窄/Calibri 轻字体系列的解决方法?

问题描述

对于 Arrial 窄或 Calibri light FontFamilies 看起来,WPF 不应用粗体或斜体。有什么办法可以做到这一点吗?我敢肯定还有其他 FontFamilies 有这个问题。

<FontFamily x:Key="SelectedFontFamily">Calibri light</FontFamily>

<Style TargetType="{x:Type TextBlock}">
    <Setter Property="FontFamily" Value="{StaticResource SelectedFontFamily}" />
    <Setter Property="FontSize" Value="12"/>
</Style>

<StackPanel>
    <TextBlock FontWeight="Thin"  Text="Jackdaws love my big sphinx of quartz - Thin - 100"/>
    <TextBlock FontWeight="UltraLight"  Text="Jackdaws love my big sphinx of quartz - UltraLight - 200" />
    <TextBlock FontWeight="ExtraLight"  Text="Jackdaws love my big sphinx of quartz - ExtraLight - 200" />
    <TextBlock FontWeight="Light"  Text="Jackdaws love my big sphinx of quartz - Light - 300" />
    <TextBlock FontWeight="Normal"  Text="Jackdaws love my big sphinx of quartz - Normal - 400" />
    <TextBlock FontWeight="Regular"  Text="Jackdaws love my big sphinx of quartz - Regular - 400" />
    <TextBlock FontWeight="Medium"  Text="Jackdaws love my big sphinx of quartz - Medium - 500" />
    <TextBlock FontWeight="DemiBold"  Text="Jackdaws love my big sphinx of quartz - DemiBold - 600" />
    <TextBlock FontWeight="SemiBold"  Text="Jackdaws love my big sphinx of quartz - SemiBold - 600" />
    <TextBlock FontWeight="Bold"  Text="Jackdaws love my big sphinx of quartz - Bold - 700"/>
    <TextBlock FontWeight="UltraBold"  Text="Jackdaws love my big sphinx of quartz - UltraBold - 800" />
    <TextBlock FontWeight="ExtraBold"  Text="Jackdaws love my big sphinx of quartz - ExtraBold - 800" />
    <TextBlock FontWeight="Heavy"  Text="Jackdaws love my big sphinx of quartz - Heavy - 900" />
    <TextBlock FontWeight="Black"  Text="Jackdaws love my big sphinx of quartz - Black - 900" />
    <TextBlock FontWeight="ExtraBlack"  Text="Jackdaws love my big sphinx of quartz - ExtraBlack - 950" />
    <TextBlock FontWeight="UltraBlack"  Text="Jackdaws love my big sphinx of quartz - UltraBlack - 950" />
</StackPanel>

结果是:

结果图像

标签: wpffonts

解决方案


推荐阅读