IDWriteFontSet::GetMatchingFonts(WCHARconst*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STRETCH,DWRITE_FONT_STYLE,IDWriteFontSet**) method (dwrite_3.h)

Returns a subset of fonts filtered by the given properties.

Syntax

HRESULT GetMatchingFonts(
  WCHAR const         *familyName,
  DWRITE_FONT_WEIGHT  fontWeight,
  DWRITE_FONT_STRETCH fontStretch,
  DWRITE_FONT_STYLE   fontStyle,
  IDWriteFontSet      **filteredSet
);

Parameters

familyName

The font family name.

fontWeight

The font weight.

fontStretch

The font stretch value.

fontStyle

The font style.

filteredSet

Type: [out] IDWriteFontSet**

The subset of fonts that match the properties, or nullptr on failure.

Return value

Type: HRESULT

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

Remarks

If no fonts matched the filter, the subset will be empty (GetFontCount returns 0), but the function does not return an error. The subset will always be equal to or less than the original set. If you only want to filter out remote fonts, you may pass null in properties and zero in propertyCount.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header dwrite_3.h
Library Dwrite.lib
DLL Dwrite.dll

See also

IDWriteFontSet