This function adds the font resource from the specified file to the Windows font table. The font can subsequently be used for text output by any Windows-based application.
At a Glance
Header file: | Wingdi.h |
Windows CE versions: | 1.0 and later |
Syntax
int AddFontResource(LPCTSTR lpszFilename);
Parameters
lpszFilename
[in] Long pointer to a null-terminated string that contains a valid font file filename. The file name can specify a font resource file (.fon), a raw bitmap font file (.fnt), a raw TrueType file (.ttf), a TrueType resource file (.fot), or a TrueType collection file (.ttc).
Return Values
The number of fonts added indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
Any application that adds or removes fonts from the system font table should notify other windows of the change by sending a WM_FONTCHANGE message to all top-level windows in the operating system. The application should send this message by calling the SendMessage function and setting the hwnd parameter to HWND_BROADCAST.
When an application no longer needs a font resource that it loaded by calling the AddFontResource function, it must remove the resource by calling the RemoveFontResource function.
Windows CE versions 2.0 and later support systems that use either TrueType or raster fonts but not both. The font type is chosen at system design time, and cannot be changed by an application.
Windows CE versions 1.0 and 1.01 support only raster fonts.
See Also