WPF/XAML:Typography.Capitals 似乎没有效果 [英] WPF/XAML: Typography.Capitals seems to have no effect
问题描述
所有这些文本看起来都一样,但我试图让它们看起来不同.我想要小写字母.我在这里缺少什么才能使小型大写字体效果发挥作用?
All of these bits of text look the same, but I am trying to get them to look different. I want small caps text. What am I missing here to get the small caps typography effect to work?
要重现这一点,请打开 Visual Studio 2008,执行文件|新建项目,创建一个新的 Windows|WPF 应用程序,将下面的标记粘贴到 Window1.xaml 中,然后运行它.
To reproduce this, open Visual Studio 2008, Do File|New Project, create a new Windows|WPF application, paste the mark-up below into Window1.xaml, then run it.
<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 开始标记更改为:
Based on the first answer, it seems that if you specify a particular font, you can get somewhere. Change the FlowDocument start tag to:
<FlowDocument FontFamily="Palatino Linotype">
.. 你会得到 SmallCaps 和 AllSmallCaps,但不是 PetiteCaps 或 AllPetiteCaps.所以这取决于字体.但这引发了其他问题:
.. and you get SmallCaps and AllSmallCaps, but not PetiteCaps or AllPetiteCaps. So it depends on the font. But this gives rise to other questions:
- 为什么默认字体(看起来很像 Times New Roman)不支持这些?
- 其他广泛使用的字体(例如本地 Courier New 等效字体)是否支持这些字体?
- 有哪些字体支持什么的列表?
- 支持此功能的字体百分比是多少?大多数、部分还是少数?
- 您能否在代码中确定字体支持什么 - 如果是这种情况,我可以伪造 AllSmallCaps - 例如通过将文本转换为全部大写并按 80% 缩放.但不是小型股.
推荐答案
这仅适用于特定的 OpenType 字体 - 帮助中的示例使用 Open Type 示例中的 Pescadero.即便如此,也仅支持 SmallCaps 和 AllSmallCaps.
This only works with specific OpenType fonts - the example in Help uses Pescadero which is in the Open Type Sample. Even then, only SmallCaps and AllSmallCaps are supported.
这篇关于WPF/XAML:Typography.Capitals 似乎没有效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!