Microsoft DirectX 9.0

D3DXCreateText Function

Creates a mesh containing the specified text, using the font associated with the device context.


HRESULT D3DXCreateText(      

    LPDIRECT3DDEVICE9 pDevice,     HDC hDC,     LPCTSTR pText,     FLOAT Deviation,     FLOAT Extrusion,     LPD3DXMESH *ppMesh,     LPD3DXBUFFER *ppAdjacency,     LPGLYPHMETRICSFLOAT pGlyphMetrics );


[in] Pointer to the device that created the mesh.
[in] Device context, containing the font for output. The font selected by the device context must be a TrueType font.
[in] Pointer to a string that specifies the text to generate. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
[in] Maximum chordal deviation from TrueType font outlines.
[in] Amount to extrude text in the negative z-direction.
[out] Pointer to the returned mesh.
[out] Pointer to a buffer containing adjacency information.
[out] Pointer to an array of LPGLYPHMETRICSFLOAT structures that contain the glyph metric data. Each element contains information about the position and orientation of the corresponding glyph in the string. The number of elements in the array should be equal to the number of characters in the string. Note that the origin in each structure is not relative to the entire string, but rather is relative to that character cell. To compute the entire bounding box, add the increment for each glyph while traversing the string.

If you are not concerned with the glyph sizes, set this parameter to NULL.

Return Value

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
D3DXERR_INVALIDDATAThe data is invalid.
E_OUTOFMEMORYMicrosoft?Direct3D?could not allocate sufficient memory to complete the call.


The compiler setting also determines the function version. If Unicode is defined, the function call resolves to D3DXCreateTextW. Otherwise, the function call resolves to D3DXCreateTextA because ANSI strings are being used.

For more information about the LPGLYPHMETRICSFLOAT structure, see the Microsoft Platform Software Development Kit (SDK).

Function Information

Import libraryd3dx9.lib
Minimum operating systems Windows 98

© 2002 Microsoft Corporation. All rights reserved.