IDWriteFactory::CreateGdiCompatibleTextLayout method (dwrite.h)
Takes a string, format, and associated constraints, and produces an object representing the result, formatted for a particular display resolution and measuring mode.
Syntax
HRESULT CreateGdiCompatibleTextLayout(
[in] WCHAR const *string,
UINT32 stringLength,
IDWriteTextFormat *textFormat,
FLOAT layoutWidth,
FLOAT layoutHeight,
FLOAT pixelsPerDip,
[in, optional] DWRITE_MATRIX const *transform,
BOOL useGdiNatural,
[out] IDWriteTextLayout **textLayout
);
Parameters
[in] string
Type: const WCHAR*
An array of characters that contains the string to create a new IDWriteTextLayout object from. This array must be of length stringLength and can contain embedded NULL characters.
stringLength
Type: UINT32
The length of the string, in character count.
textFormat
Type: IDWriteTextFormat*
The text formatting object to apply to the string.
layoutWidth
Type: FLOAT
The width of the layout box.
layoutHeight
Type: FLOAT
The height of the layout box.
pixelsPerDip
Type: FLOAT
The number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI device pixelsPerDip is 1. If rendering onto a 120 DPI device pixelsPerDip is 1.25 (120/96).
[in, optional] transform
Type: const DWRITE_MATRIX*
An optional transform applied to the glyphs and their positions. This transform is applied after the scaling specifies the font size and pixels per DIP.
useGdiNatural
Type: BOOL
Instructs the text layout to use the same metrics as GDI bi-level text when set to FALSE. When set to TRUE, instructs the text layout to use the same metrics as text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY.
[out] textLayout
Type: IDWriteTextLayout**
When this method returns, contains an address to the pointer of the resultant text layout object.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
The resulting text layout should only be used for the intended resolution, and for cases where text scalability is desired CreateTextLayout should be used instead.
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 |