The GetFontData function retrieves font metric data for a TrueType font.
DWORD GetFontData(
HDC hdc, // handle to device context
DWORD dwTable, // metric table to query
DWORD dwOffset, // offset into table being queried
LPVOID lpvBuffer, // pointer to buffer for returned data
DWORD cbData // length of data to query
);
If the function succeeds, the return value is the number of bytes returned.
If the function fails, the return value is GDI_ERROR.
Windows NT: To get extended error information, call GetLastError.
An application can sometimes use the GetFontData function to save a TrueType font with a document. To do this, the application determines whether the font can be embedded by checking the otmfsType member of the OUTLINETEXTMETRIC structure. If bit 1 of otmfsType is set, embedding is not permitted for the font. If bit 1 is clear, the font can be embedded. If bit 2 is set, the embedding is read-only. If embedding is permitted, the application can retrieve the entire font file, specifying zero for the dwTable, dwOffset, and cbData parameters.
If an application attempts to use this function to retrieve information for a non-TrueType font, an error occurs.
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.
Fonts and Text Overview, Font and Text Functions, GetTextMetrics, OUTLINETEXTMETRIC