IDWriteFontSet4::ConvertWeightStretchStyleToFontAxisValues method (dwrite_3.h)

Computes derived font axis values from the specified font weight, stretch, style, and size.

Syntax

UINT32 ConvertWeightStretchStyleToFontAxisValues(
  DWRITE_FONT_AXIS_VALUE const *inputAxisValues,
  UINT32                       inputAxisCount,
  DWRITE_FONT_WEIGHT           fontWeight,
  DWRITE_FONT_STRETCH          fontStretch,
  DWRITE_FONT_STYLE            fontStyle,
  float                        fontSize,
  DWRITE_FONT_AXIS_VALUE       *outputAxisValues
);

Parameters

inputAxisValues

Type: _In_reads_opt_(inputAxisCount) DWRITE_FONT_AXIS_VALUE const*

Optional pointer to an array of input axis values. Axes present in this array are excluded from the output. That's so that explicit axis values take precedence over derived axis values.

inputAxisCount

Type: UINT32

Size of the array of input axis values.

fontWeight

Type: DWRITE_FONT_WEIGHT

Font weight, used to compute "wght" axis value.

fontStretch

Type: DWRITE_FONT_STRETCH

Font stretch, used to compute "wdth" axis value.

fontStyle

Type: DWRITE_FONT_STYLE

Font style, used to compute "slnt" and "ital" axis values.

fontSize

Type: float

Font size in DIPs, used to compute "opsz" axis value. If this parameter is zero, then no "opsz" axis value is added to the output array.

outputAxisValues

Type: _Out_writes_to_(DWRITE_STANDARD_FONT_AXIS_COUNT, return) DWRITE_FONT_AXIS_VALUE*

Pointer to an output array to which derived axis values are written. The size of this array must be at least DWRITE_STANDARD_FONT_AXIS_COUNT (5). The return value is the number of axis values that were actually written to this array.

Return value

Type: UINT32

Returns the number of derived axis values that were actually written to the output array.

Remarks

The caller should concatenate the output axis values to the input axis values (if any), and pass the combined axis values to the GetMatchingFonts method. This doesn't result in duplicates because the output doesn't include any axes present in the inputAxisValues array.

Requirements

Requirement Value
Minimum supported client Windows 11 Build 22621
Header dwrite_3.h
Library Dwrite.lib
DLL Dwrite.dll