1 out of 1 rated this helpful - Rate this topic

GetTextFace function

Applies to: desktop apps only

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

Minimum supported server

Windows 2000 Server

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

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ