【问题标题】:Font weight and style do not map correctly in silverlightSilverlight 中的字体粗细和样式未正确映射
【发布时间】:2012-08-01 11:46:59
【问题描述】:

当我在 WPf 项目中有以下 Xaml 时:

    <StackPanel
        VerticalAlignment="Center">
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI"
            FontWeight="Light"
            Text="This is a test (light)" />
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI Light"
            Text="This is a test (font.light)" />
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI"
            Text="This is a test (normal)" />
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI"
            FontWeight="SemiBold"
            Text="This is a test (semibold)" />
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI Semibold"
            Text="This is a test (font.semibold)" />
        <TextBlock
            FontSize="40"
            FontFamily="Segoe UI"
            FontWeight="Bold"
            Text="This is a test (bold)" />
    </StackPanel>

字体按预期呈现。但是,当我在 Silverlight 项目中使用它时,FontWeight 为 Light 或 Semibold 的文本块无法正确呈现; FontWeight="Light" 版本只使用普通字体,FontWeight="Semibold" 使用粗体版本。当明确说明字体名称时,即“Segoe UI Light”和“Segeo UI Semibold”,它会按预期工作。似乎 Silverlight 没有像 WPF 那样将某些 FontWeight 值映射到正确的字体。这是一个错误还是我错过了什么?

提前致谢, 罗伯特

【问题讨论】:

    标签: silverlight fonts mapping


    【解决方案1】:

    Silverlight 仅包含开箱即用的某些字体。除非您在项目中明确包含它们并将它们作为 xap 的一部分分发,否则无法正确显示的那些根本不可用。

    格雷格

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-10
      • 2011-11-07
      • 1970-01-01
      • 2021-08-23
      • 2016-11-22
      • 1970-01-01
      • 2017-04-05
      相关资源
      最近更新 更多