다음을 통해 공유


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

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

구문

Status GetFamilies(
  [in]  INT        numSought,
  [out] FontFamily *gpfamilies,
  [out] INT        *numFound
);

매개 변수

[in] numSought

형식: INT

이 글꼴 컬렉션의 글꼴 패밀리 수를 지정하는 정수입니다.

[out] gpfamilies

형식: FontFamily*

FontFamily 개체를 수신하는 배열에 대한 포인터입니다.

[out] numFound

형식: INT*

이 컬렉션에 있는 글꼴 패밀리 수를 수신하는 INT 에 대한 포인터입니다. 이 숫자는 numSought 값과 동일해야 합니다.

반환 값

형식: 상태

메서드가 성공하면 Status 열거형의 요소인 확인을 반환합니다. 메서드가 실패하면 Status 열거형의 다른 요소 중 하나를 반환합니다.

설명

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

예제

다음 예제에서는 PrivateFontCollection 개체를 만들고, 컬렉션에 포함된 FontFamily 개체를 가져오고, 글꼴 패밀리 중 하나를 사용하여 텍스트를 그립니다.

VOID Example_GetFamilies(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");

   // Create an array to hold the font families, and get the font families of
   // fontCollection.
   FontFamily families[3];
   int numFamilies;
   fontCollection.GetFamilies(3, families, &numFamilies);

   // Create a Font object from the first FontFamily object in the array.
   Font myFont(&families[0], 16);

   // Use myFont to draw text.
   SolidBrush solidbrush(Color(255, 0, 0, 0));
   WCHAR string[] = L"This is an Arial font";
   graphics.DrawString(string,
                       21, &myFont, PointF(0, 0), &solidbrush);
}

요구 사항

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

추가 정보

FontCollection

FontCollection::GetFamilyCount

FontFamily

PrivateFontCollection

텍스트 및 글꼴 사용