基于this answer关于WPF中模糊文本的问题,我尝试使用TextOptions.TextFormattingMode = TextFormattingMode.Display
,但似乎它也会改变字母之间的间距:
TextFormattingMode.Display
会导致z
和e
个字符混合到另一个字符中:
虽然使用TextFormattingMode.Ideal
:
向上缩放文本时,差异变得更加明显(左侧TextFormattingMode.Display
):
仅在使用Segoe UI Semilight
且仅使用12pt字体大小时才会发生此行为。
为什么会这样?这是特定字体,WPF渲染引擎的问题还是这个实际需要的行为?
编辑:如果你想自己检查一下,这里有一些可以复制的示例代码:
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="Segoe UI Semilight" />
<Setter Property="FontSize" Value="12" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="size"
TextOptions.TextFormattingMode="Display" />
<TextBlock Grid.Row="1"
Text="size"
TextOptions.TextFormattingMode="Ideal" />
</Grid>
答案 0 :(得分:0)
这是实际的通缉行为。您可以尝试使用&#34; HELLO WORLD&#34;字符串,你会知道真正的区别。使用这些模式的常见方案是: