IDWriteFactory::CreateCustomFontFileReference method (dwrite.h)

Creates a reference to an application-specific font file resource.


HRESULT CreateCustomFontFileReference(
  [in]  void const            *fontFileReferenceKey,
        UINT32                fontFileReferenceKeySize,
        IDWriteFontFileLoader *fontFileLoader,
  [out] IDWriteFontFile       **fontFile


[in] fontFileReferenceKey

Type: const void*

A font file reference key that uniquely identifies the font file resource during the lifetime of fontFileLoader.


Type: UINT32

The size of the font file reference key in bytes.


Type: IDWriteFontFileLoader*

The font file loader that will be used by the font system to load data from the file identified by fontFileReferenceKey.

[out] fontFile

Type: IDWriteFontFile**

Contains an address of a pointer to the newly created font file object when this method succeeds, or NULL in case of failure.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


This function is provided for cases when an application or a document needs to use a private font without having to install it on the system. fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call.


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite.h
Library Dwrite.lib
DLL Dwrite.dll

See also