AddFontMemResourceEx function (wingdi.h)

The AddFontMemResourceEx function adds the font resource from a memory image to the system.

Syntax

HANDLE AddFontMemResourceEx(
  [in] PVOID pFileView,
  [in] DWORD cjSize,
  [in] PVOID pvResrved,
  [in] DWORD *pNumFonts
);

Parameters

[in] pFileView

A pointer to a font resource.

[in] cjSize

The number of bytes in the font resource that is pointed to by pbFont.

[in] pvResrved

Reserved. Must be 0.

[in] pNumFonts

A pointer to a variable that specifies the number of fonts installed.

Return value

If the function succeeds, the return value specifies the handle to the font added. This handle uniquely identifies the fonts that were installed on the system. If the function fails, the return value is zero. No extended error information is available.

Remarks

This function allows an application to get a font that is embedded in a document or a webpage. A font that is added by AddFontMemResourceEx is always private to the process that made the call and is not enumerable.

A memory image can contain more than one font. When this function succeeds, pcFonts is a pointer to a DWORD whose value is the number of fonts added to the system as a result of this call. For example, this number could be 2 for the vertical and horizontal faces of an Asian font.

When the function succeeds, the caller of this function can free the memory pointed to by pbFont because the system has made its own copy of the memory. To remove the fonts that were installed, call RemoveFontMemResourceEx. However, when the process goes away, the system will unload the fonts even if the process did not call RemoveFontMemResource.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

DESIGNVECTOR

Font and Text Functions

Fonts and Text Overview

RemoveFontMemResourceEx

SendMessage