다음을 통해 공유


FontCollection::GetFamilyCount 메서드(gdiplusheaders.h)

FontCollection::GetFamilyCount 메서드는 이 글꼴 컬렉션에 포함된 글꼴 패밀리 수를 가져옵니다.

구문

INT GetFamilyCount();

반환 값

형식: INT

이 메서드는 이 글꼴 컬렉션에 포함된 글꼴 패밀리 수를 반환합니다.

설명

글꼴 패밀리는 관련 스타일이 있는 단일 글꼴 형식으로 구성됩니다. 단일 글꼴 형식의 예는 Arial Regular입니다. 글꼴 패밀리의 예로 Arial Regular, Arial Italic 및 Arial Bold 스타일 글꼴을 포함하는 글꼴 집합이 있습니다.

예제

다음 예제에서는 PrivateFontCollection 개체를 만들고 컬렉션에 포함된 FontFamily 개체의 수를 가져오고 해당 숫자를 출력합니다.

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

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdiplusheaders.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

추가 정보

FontCollection

PrivateFontCollection

텍스트 및 글꼴 사용