GetTextFace

The GetTextFace function retrieves the typeface name of the font that is selected into the specified device context.

int GetTextFace(
  HDC hdc,            // handle to device context
  int nCount,         // length of buffer receiving typeface name
  LPTSTR lpFaceName   // pointer to buffer receiving typeface name
);
 

Parameters

hdc
Handle to the device context.
nCount
Specifies the size, in characters, of the buffer.
lpFaceName
Pointer to the buffer that is to receive the typeface name. If this parameter is NULL, the function returns the number of characters in the name, including the terminating null character.

Return Values

If the function succeeds, the return value is the number of characters copied to the buffer.

If the function fails, the return value is zero.

Windows NT: To get extended error information, call GetLastError.

Remarks

The typeface name is copied as a null-terminated character string.

If the name is longer than the number of characters specified by the nCount parameter, the name is truncated.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in wingdi.h.
  Import Library: Use gdi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Fonts and Text Overview, Font and Text Functions, GetTextAlign, GetTextColor, GetTextExtentPoint32, GetTextMetrics