Freigeben über


IDWriteFontFamily Interface

Represents a family of related fonts.

Mitglieder

IDWriteFontFamilySchnittstelle erbt von IDWriteFontList. IDWriteFontFamily umfasst auch die folgenden Typen von Mitgliedern:

  • Methoden

Methoden

IDWriteFontFamilySchnittstelle umfasst die folgenden Methoden.

Methode Beschreibung
GetFamilyNames

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

GetFirstMatchingFont

Gets the font that best matches the specified properties.

GetMatchingFonts

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

 

Hinweise

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);
}

Anforderungen

Mindestens unterstützter Client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista

Mindestens unterstützter Server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008

Header

Dwrite.h

Bibliothek

Dwrite.lib

DLL

Dwrite.dll