GetTextFaceA function (wingdi.h)

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

Syntax

int GetTextFaceA(
  [in]  HDC   hdc,
  [in]  int   c,
  [out] LPSTR lpName
);

Parameters

[in] hdc

A handle to the device context.

[in] c

The length of the buffer pointed to by lpFaceName. For the ANSI function it is a BYTE count and for the Unicode function it is a WORD count. Note that for the ANSI function, characters in SBCS code pages take one byte each, while most characters in DBCS code pages take two bytes; for the Unicode function, most currently defined Unicode characters (those in the Basic Multilingual Plane (BMP)) are one WORD while Unicode surrogates are two WORDs.

[out] lpName

A pointer to the buffer that receives the typeface name. If this parameter is NULL, the function returns the number of characters in the name, including the terminating null character.

Return value

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.

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.

Note

The wingdi.h header defines GetTextFace as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Font and Text Functions

Fonts and Text Overview

GetTextAlign

GetTextColor

GetTextExtentPoint32

GetTextMetrics