Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

How to: Enumerate System Fonts

The following example shows how to enumerate the fonts in the system font collection. The font family name of each FontFamily within SystemFontFamilies is added as an item to a combo box.

public void FillFontComboBox(ComboBox comboBoxFonts)
    // Enumerate the current set of system fonts, 
    // and fill the combo box with the names of the fonts. 
    foreach (FontFamily fontFamily in Fonts.SystemFontFamilies)
        // FontFamily.Source contains the font family name.

    comboBoxFonts.SelectedIndex = 0;

If multiple versions of the same font family reside in the same directory, the Windows Presentation Foundation (WPF) font enumeration returns the most recent version of the font. If the version information does not provide resolution, the font with latest timestamp is returned. If the timestamp information is equivalent, the font file that is first in alphabetical order is returned.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.