wpfxamlflowdocumentsmallcaps

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?

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>   

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">

.. and you get SmallCaps and AllSmallCaps, but not PetiteCaps or AllPetiteCaps. So it depends on the font. But this gives rise to other questions:


Solution

  • 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.