IDWriteFactory::CreateTextFormat method (dwrite.h)

Creates a text format object used for text layout.

Syntax

HRESULT CreateTextFormat(
  [in]  WCHAR const           *fontFamilyName,
        IDWriteFontCollection *fontCollection,
        DWRITE_FONT_WEIGHT    fontWeight,
        DWRITE_FONT_STYLE     fontStyle,
        DWRITE_FONT_STRETCH   fontStretch,
        FLOAT                 fontSize,
  [in]  WCHAR const           *localeName,
  [out] IDWriteTextFormat     **textFormat
);

Parameters

[in] fontFamilyName

Type: const WCHAR*

An array of characters that contains the name of the font family

fontCollection

Type: IDWriteFontCollection*

A pointer to a font collection object. When this is NULL, indicates the system font collection.

fontWeight

Type: DWRITE_FONT_WEIGHT

A value that indicates the font weight for the text object created by this method.

fontStyle

Type: DWRITE_FONT_STYLE

A value that indicates the font style for the text object created by this method.

fontStretch

Type: DWRITE_FONT_STRETCH

A value that indicates the font stretch for the text object created by this method.

fontSize

Type: FLOAT

The logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.

[in] localeName

Type: const WCHAR*

An array of characters that contains the locale name.

[out] textFormat

Type: IDWriteTextFormat**

When this method returns, contains an address of a pointer to a newly created text format object, or NULL in case of failure.

Return value

Type: HRESULT

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

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite.h
Library Dwrite.lib
DLL Dwrite.dll

See also

IDWriteFactory