IDWriteFontSet1::GetMatchingFonts method (dwrite_3.h)

Retrieves a matching font set based on the requested inputs, ordered so that nearer matches are earlier.

Syntax

HRESULT GetMatchingFonts(
  DWRITE_FONT_PROPERTY const   *fontProperty,
  DWRITE_FONT_AXIS_VALUE const *fontAxisValues,
  UINT32                       fontAxisValueCount,
  IDWriteFontSet1              **matchingFonts
);

Parameters

fontProperty

Type: DWRITE_FONT_PROPERTY const *

Font property of interest, such as typographic family or weight/stretch/style family.

fontAxisValues

Type: DWRITE_FONT_AXIS_VALUE const *

A pointer to an array containing a list of font axis values. The array should be the size (the number of elements) indicated by the fontAxisValueCount argument.

fontAxisValueCount

Type: UINT32

The number of font axis values contained in the fontAxisValues array.

matchingFonts

Type: IDWriteFontSet1**

The address of a pointer to an IDWriteFontSet1 interface. On successful completion, the function sets the pointer to a prioritized list of fonts that match the properties, 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.

Remarks

This method can yield distinct items that were not in the original font set, including items with simulation flags (if they would be a closer match to the request), and instances that were not named by the font author. Items from the same font resources are collapsed into one: the closest possible match.

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