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?
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);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With