所有这些文本看起来都一样,但我试图让它们看起来与众不同。我想要小帽子文字。我在这里错过了什么让小帽子排版效果起作用?
要重现这一点,请打开Visual Studio 2008,Do File | New Project,创建一个新的Windows | WPF应用程序,将下面的标记粘贴到Window1.xaml中,然后运行它。
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<FlowDocumentReader>
<FlowDocument>
<Paragraph>
<Run>Some text</Run> <LineBreak />
<Run Typography.Capitals="SmallCaps">Some text</Run> <LineBreak />
<Run Typography.Capitals="AllSmallCaps">Some text</Run> <LineBreak />
<Run Typography.Capitals="PetiteCaps">Some text</Run> <LineBreak />
<Run Typography.Capitals="AllPetiteCaps">Some text</Run> <LineBreak />
</Paragraph>
</FlowDocument>
</FlowDocumentReader>
</Grid>
</Window>
基于第一个答案,似乎如果你指定一个特定的字体,你可以到达某个地方。将FlowDocument开始标记更改为:
<FlowDocument FontFamily="Palatino Linotype">
..你得到SmallCaps和AllSmallCaps,但不是PetiteCaps或AllPetiteCaps。所以它取决于字体。但这引起了其他问题:
答案 0 :(得分:9)
这仅适用于特定的OpenType字体 - 帮助中的示例使用Pescadero,它位于Open Type Sample中。即使这样,也只支持SmallCaps和AllSmallCaps。
答案 1 :(得分:3)
我注意到带有“粗体”字体的默认字体会正确渲染SmallCaps:
<StackPanel>
<TextBlock Typography.Capitals="SmallCaps" FontFamily="Pescadero" Padding="2">2pm</TextBlock>
<TextBlock Typography.Capitals="SmallCaps" FontWeight="Bold" Padding="2">2pm</TextBlock>
</StackPanel>