Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function retrieves font metric data for a TrueType font.

Syntax

DWORD GetFontData(
  HDC 
hdc, 
  DWORD 
dwTable, 
  DWORD 
dwOffset, 
  LPVOID 
lpvBuffer, 
  DWORD 
cbData
);

Parameters

hdc

[in] Handle to the device context.

dwTable

[in] Specifies the name of a font metric table from which the font data is to be retrieved. This parameter can identify one of the metric tables documented in the TrueType Font Files specification published by Microsoft Corporation. If this parameter is zero, the information is retrieved starting at the beginning of the font file.

dwOffset

[in] Specifies the offset from the beginning of the font metric table to the location where the function should begin retrieving information. If this parameter is zero, the information is retrieved starting at the beginning of the table specified by the dwTableparameter. If this value is greater than or equal to the size of the table, an error occurs.

lpvBuffer

[out] Pointer to a buffer that receives the font information. If this parameter is NULL, the function returns the size of the buffer required for the font data.

cbData

[in] Specifies the length, in bytes, of the information to be retrieved. If this parameter is zero, GetFontDatareturns the size of the data specified in the dwTableparameter.

Return Value

If the function succeeds, the return value is the number of bytes returned.

If the function fails, the return value is GDI_ERROR.

To get extended error information, call GetLastError.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

Remarks

Note:
If an application attempts to use this function to retrieve information for a non-TrueType font, an error occurs.

See Also