IDWriteFontFamily interface (dwrite.h)

Represents a family of related fonts.


The IDWriteFontFamily interface inherits from IDWriteFontList. IDWriteFontFamily also has these types of members:


The IDWriteFontFamily interface has these methods.


Creates a localized strings object that contains the family names for the font family, indexed by locale name. (IDWriteFontFamily.GetFamilyNames)

Gets the font that best matches the specified properties.

Gets a list of fonts in the font family ranked in order of how well they match the specified properties.


A font family is a set of fonts that share the same family name, such as "Times New Roman", but that differ in features. These feature differences include style, such as italic, and weight, such as bold.

The following illustration shows examples of fonts that are members of the "Times New Roman" font family.

Illustration of italic, bold, and bold italic text from the Times New Roman font family An IDWriteFontFamily object can be retrieved from a font collection using the IDWriteFontCollection::GetFontFamily method shown in the following example. GetFontFamily takes a UINT32 index and returns the font family for the font at that index.
IDWriteFontFamily* pFontFamily = NULL;

// Get the font family.
if (SUCCEEDED(hr))
    hr = pFontCollection->GetFontFamily(i, &pFontFamily);

The font family name is used to specify the font family for text layout and text format objects. You can get a list of localized font family names from an IDWriteFontFamily object in the form of an IDWriteLocalizedStrings object by using the IDWriteFontFamily::GetFamilyNames method, as shown in the following code.

IDWriteLocalizedStrings* pFamilyNames = NULL;

// Get a list of localized strings for the family name.
if (SUCCEEDED(hr))
    hr = pFontFamily->GetFamilyNames(&pFamilyNames);


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite.h

See also