FontCollection::GetFamilyCount-Methode (gdiplusheaders.h)

Die FontCollection::GetFamilyCount-Methode ruft die Anzahl der Schriftartenfamilien ab, die in dieser Schriftartensammlung enthalten sind.

Syntax

INT GetFamilyCount();

Rückgabewert

Typ: INT

Diese Methode gibt die Anzahl der Schriftartenfamilien zurück, die in dieser Schriftartenauflistung enthalten sind.

Hinweise

Eine Schriftartenfamilie besteht aus einem einzelnen Schriftarttyp mit verwandten Formatvorlagen. Ein Beispiel für einen einzelnen Schriftarttyp ist Arial Regular. Ein Beispiel für eine Schriftartenfamilie ist eine Gruppe von Schriftarten, die arial Regular, Arial Italic und Arial Bold enthalten.

Beispiele

Im folgenden Beispiel wird ein PrivateFontCollection-Objekt erstellt, die Anzahl der in der Auflistung enthaltenen FontFamily-Objekte abgerufen und diese Zahl ausgegeben.

VOID Example_GetFamilyCount(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a PrivateFontCollection object, and add three families.
   PrivateFontCollection fontCollection;
   fontCollection.AddFontFile(L"C:\\WINNT\\Fonts\\Arial.ttf");
   fontCollection.AddFontFile(L"C:\\WINNT\\Fonts\\CourBI.ttf");
   fontCollection.AddFontFile(L"C:\\WINNT\\Fonts\\TimesBd.ttf");

   // Get the number of font families in the collection.
   int numFamilies = fontCollection.GetFamilyCount();

   // Print the number of families as text.
   SolidBrush solidbrush(Color(255, 0, 0, 0));
   Font       font(L"Arial", 16);
   WCHAR      string[256];
   swprintf_s(string, L"There are %i families in fontCollection.", numFamilies);
   graphics.DrawString(string,
                       wcslen(string), &font, PointF(0, 0), &solidbrush);
}

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client) Windows XP, Windows 2000 Professional [nur Desktop-Apps]
Unterstützte Mindestversion (Server) Windows 2000 Server [nur Desktop-Apps]
Zielplattform Windows
Kopfzeile gdiplusheaders.h (include Gdiplus.h)
Bibliothek Gdiplus.lib
DLL Gdiplus.dll

Weitere Informationen

Fontcollection

Privatefontcollection

Verwenden von Text und Schriftarten