GetCharWidthFloat

The GetCharWidthFloat function retrieves the fractional widths of consecutive characters in a specified range from the current font.

BOOL GetCharWidthFloat(
  HDC hdc,         // handle to device context
  UINT iFirstChar, // first-character code point
  UINT iLastChar,  // last-character code point
  PFLOAT pxBuffer  // pointer to buffer that receives width-values
);
 

Parameters

hdc
Handle to the device context.
iFirstChar
Specifies the code point of the first character in the group of consecutive characters.
iLastChar
Specifies the code point of the last character in the group of consecutive characters.
pxBuffer
Pointer to a buffer to receive the character widths.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

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

Remarks

The returned widths are in the 32-bit IEEE floating-point format. (The widths are measured along the base line of the characters.)

If the iFirstChar parameter identifies the letter a and the iLastChar parameter identifies the letter z, GetCharWidthFloat retrieves the widths of all lowercase characters.

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

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  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, GetCharABCWidths, GetCharABCWidthsFloat, GetCharWidth32