Obtain installed fonts as a list
11,469
You want the InstalledFontCollection
class:
using System.Drawing.Text;
using (InstalledFontCollection fontsCollection = new InstalledFontCollection())
{
FontFamily[] fontFamilies = fontsCollection.Families;
List<string> fonts = new List<string>();
foreach (FontFamily font in fontFamilies)
{
fonts.Add(font.Source);
}
}
Author by
Naufal Fikri
Updated on June 24, 2022Comments
-
Naufal Fikri almost 2 years
is there any way I can obtain installed fonts as a list (or array, but I prefer a List).
So like a method that will out all installed fonts to a list. I have so far created this
List<string> fonts = new List<string>(); fonts.AddRange() //I don't know what to put in those brackets to obtain fonts.
Can someone provide a better way?