list all installed fonts code example

Example: how to get a list of all fonts installed on your computer

private System.Drawing.FontFamily[] GetInstalledFonts_FontFamily()
{
	return new System.Drawing.Text.InstalledFontCollection().Families;
}

private System.Drawing.Font[] GetInstalledFonts_Font()
{
	FontFamily[] installedFamilies = GetInstalledFonts_FontFamily();
    Font[] installedFonts = new Font[installedFamilies.Length];
    
    for (int i = 0; i < installedFamilies.Length; i++)
    {
    	installedFonts[i] = new Font(installedFamilies[i].Name, 0.0f);
    }
    
    return installedFonts;
}

private string[] GetInstalledFonts_Names()
{
	Font[] installedFonts = GetInstalledFonts_Font();
    string[] fontNames = new string[installedFonts.Length];
    
    for (int i = 0; i < installedFonts.Length; i++)
    {
    	fontNames[i] = installedFonts[i].Name;
    }
    
    return fontNames;
}