#814 – You Can Specify a List of Fonts to Try

You normally indicate the font or typeface to use in rendering a control by specifying a value for the FontFamily property.

        <TextBlock Padding="20,10" FontSize="16"
                   FontFamily="Corbel">
            I drank what?  --Socrates
        </TextBlock>

814-001
However, you can also supply a list of fonts for the FontFamily property.  WPF will attempt to use the first font listed, but if the font is not installed on the target system, it will fall back to the next font in the list.  This fallback mechanism will continue, as WPF tries each font in the list.  If none of the fonts listed are found, WPF will use the default font, Segoe UI.

        <TextBlock Padding="20,10" FontSize="16"
                   FontFamily="Baskerville,Georgia">
            I drank what?  --Socrates
        </TextBlock>

814-002

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #814 – You Can Specify a List of Fonts to Try

  1. Pingback: Dew Drop – May 7, 2013 (#1,542) | Alvin Ashcraft's Morning Dew

Leave a comment