Fonts.GetTypefaces Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the collection of Typeface objects from a string value that represents the font directory location.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public static ICollection<Typeface> GetTypefaces(
	string location


Type: System.String

The location that contains the fonts.

Return Value

Type: System.Collections.Generic.ICollection<Typeface>

An ICollection<T> of Typeface objects that represent the fonts in location.

Exception Condition

The location is null. You cannot pass null, because this parameter is treated as a path or URI.

The following example shows how to use this method to return the collection of Typeface objects from a font location.

foreach (Typeface typeface in Fonts.GetTypefaces("D:/MyFonts/"))
    // Perform action.

.NET Framework
Available since 3.0
Return to top