Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GetCharWidth32 function

The GetCharWidth32 function retrieves the widths, in logical coordinates, of consecutive characters in a specified range from the current font.

Syntax


BOOL GetCharWidth32(
  _In_  HDC   hdc,
  _In_  UINT  iFirstChar,
  _In_  UINT  iLastChar,
  _Out_ LPINT lpBuffer
);

Parameters

hdc [in]

A handle to the device context.

iFirstChar [in]

The first character in the group of consecutive characters.

iLastChar [in]

The last character in the group of consecutive characters, which must not precede the specified first character.

lpBuffer [out]

A pointer to a buffer that receives the character widths, in logical coordinates.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

GetCharWidth32 cannot be used on TrueType fonts. To retrieve character widths for TrueType fonts, use GetCharABCWidths.

The range is inclusive; that is, the returned widths include the widths of the characters specified by the iFirstChar and iLastChar parameters.

If a character does not exist in the current font, it is assigned the width of the default character.

Examples

For an example, see "Displaying Keyboard Input" in Using Keyboard Input.

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

GetCharWidth32W (Unicode) and GetCharWidth32A (ANSI)

See also

Fonts and Text Overview
Font and Text Functions
GetCharABCWidths
GetCharABCWidthsFloat
GetCharWidthFloat

 

 

Show: