【问题标题】:How can I change FontWeight of paragraph when FontFamily of a FlowDocument is set?设置 FlowDocument 的 FontFamily 时如何更改段落的 FontWeight?
【发布时间】:2017-09-04 21:41:47
【问题描述】:

假设FlowDocument 具有以下样式。

<Style TargetType="{x:Type FlowDocument}">
    <Setter Property="FontFamily" Value="Segoe UI regular"/>
    <Setter Property="FontSize" Value="16"/>
    <Setter Property="LineHeight" Value="19"/>
</Style>

现在由于某种原因这不会使它变粗。

<Paragraph>
    <Bold>Is this bold?</Bold>
</Paragraph>

甚至这个

<Run FontWeight="Bold" Text="{DynamicResource CMMsg_7114}" />

请记住,如果我不设置父 FontFamily 并使用默认字体,这两种方法都可以正常工作。知道如何解决这个问题吗?

【问题讨论】:

  • 非常感谢!

标签: c# wpf paragraph flowdocument


【解决方案1】:

FontFamily“Segoe UI regular”不支持粗体字符。将FontFamily 更改为“Segoe UI”:

<Style TargetType="{x:Type FlowDocument}">
    <Setter Property="FontFamily" Value="Segoe UI"/>
    <Setter Property="FontSize" Value="16"/>
    <Setter Property="LineHeight" Value="19"/>
</Style>

【讨论】:

    猜你喜欢
    • 2010-11-18
    • 1970-01-01
    • 1970-01-01
    • 2019-05-02
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多