IDWriteFactory6::CreateFontResource method (dwrite_3.h)

Creates a font resource, given a font file and a face index.

Syntax

HRESULT CreateFontResource(
  IDWriteFontFile     *fontFile,
  UINT32              faceIndex,
  IDWriteFontResource **fontResource
);

Parameters

fontFile

Type: IDWriteFontFile*

A user-provided font file representing the font face.

faceIndex

Type: UINT32

The zero-based index of a font face in cases when the font file contains a collection of font faces. If the font file contains a single face, then set this value to zero.

fontResource

Type: IDWriteFontResource**

The address of a pointer to an IDWriteFontResource interface. On successful completion, the function sets the pointer to a newly created font resource object, otherwise it sets the pointer to nullptr.

Return value

Type: HRESULT

If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Target Platform Windows
Header dwrite_3.h
Library Dwrite.lib