Installed Font Name List Using Generator

Description: This is a simple function for generating a list of installed font names. Great for drop down menus that need to see the type of fonts installed and then used to select that font.
Tested Platform: .NET 4.8, Visual Studio 2022, Windows 10
Language: C#
// List installed font family names using a font generator list.

public static IEnumerable<string> listInstalledFonts()  {
    System.Drawing.Text.InstalledFontCollection InstalledFonts = new System.Drawing.Text.InstalledFontCollection();

    System.Drawing.FontFamily[] families = InstalledFonts.Families;

    for (int i = 0; i < families.Length; i++) {
        yield return families[i].Name;

Posted: March 19, 2023

Return to the snippets listing