IDWriteFactory6::CreateTextFormat method (dwrite_3.h)

Creates a text format object used for text layout.

Syntax

HRESULT CreateTextFormat(
  WCHAR const                  *fontFamilyName,
  IDWriteFontCollection        *fontCollection,
  DWRITE_FONT_AXIS_VALUE const *fontAxisValues,
  UINT32                       fontAxisValueCount,
  FLOAT                        fontSize,
  WCHAR const                  *localeName,
  IDWriteTextFormat3           **textFormat
);

Parameters

fontFamilyName

Type: WCHAR const *

Name of the font family from the collection.

fontCollection

Type: IDWriteFontCollection*

Font collection. Use nullptr to indicate the system font collection.

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.

fontSize

Type: FLOAT

Logical size of the font in DIP units.

localeName

Type: WCHAR const *

Locale name (for example, "ja-JP", "en-US", "ar-EG").

textFormat

Type: IDWriteTextFormat3**

The address of a pointer to an IDWriteTextFormat3 interface. On successful completion, the function sets the pointer to a newly created text format 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.

Remarks

If fontCollection is nullptr, then the system font collection is used, grouped by typographic family name (DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC) without downloadable fonts.

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