Practical Approach of Getting System Installed Fonts at Runtime Using C# ASP.NET


Introduction

In this article we are going to see how to retrieve the System fonts at runtime and add them as a List collection.

Useful Tips

  1. It helps to check whether a required font is available or not.
  2. If a font does not exist then we can adapt and use a different font.

CODE SNIPPET

public static List<string> GetSystemInstalledFonts()

{

List<string> lst = new List<string>();

InstalledFontCollection fonts = new InstalledFontCollection();

for (int i = 0; i < fonts.Families.Length; i++)

{

lst.Add(fonts.Families[i].Name);

}

return lst;

}

Output


1.jpg

Location of System Installed Fonts

Step 1: Type "Fonts" in the Run command and Click OK.

2.jpg

Step 2: You will get the Path of the Installed Fonts.

3.jpg

Conclusion

So in this article you have learned how to get the System fonts and add them to a Collection. Thanks for reading.


Similar Articles