Export (0) Print
Expand All

GetTextFace function

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

Syntax


int GetTextFace(
  _In_   HDC    hdc,
  _In_   int    nCount,
  _Out_  LPTSTR lpFaceName
);

Parameters

hdc [in]

A handle to the device context.

nCount [in]

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.

lpFaceName [out]

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

Unicode and ANSI names

GetTextFaceW (Unicode) and GetTextFaceA (ANSI)

See also

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

 

 

Community Additions

ADD
Show:
© 2015 Microsoft