Microsoft DirectX 8.0 (C++)

D3DXCreateTextA

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

HRESULT D3DXCreateTextA(
  LPDIRECT3DDEVICE8 pDevice,
  HDC hDC,
  LPCSTR pText,
  FLOAT Deviation,
  FLOAT Extrusion,
  LPD3DXMESH* ppMesh,
  LPGLYPHMETRICSFLOAT pGlyphMetrics
);

Parameters

pDevice
[in] Pointer to an IDirect3DDevice8 interface, representing the device associated with the created text mesh.
hDC
[in] Device context, containing the font for output. The font selected by the device context must be a TrueType font.
pText
[in] Pointer to an ANSI string, specifying the text to generate.
Deviation
[in] Maximum chordal deviation from true font outlines.
Extrusion
[in] Amount to extrude text in the negative Z direction.
ppMesh
[out] Address of a pointer to the output shape, an ID3DXMesh interface.
pGlyphMetrics
[out] Pointer to an array of GLYPHMETRICSFLOAT structures to receive the glyph metric data. Each GLYPHMETRICSFLOAT structure in the array contains information about the placement 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, you can pass NULL to pGlyphMetrics.

Return Values

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_INVALIDCALL
D3DXERR_INVALIDDATA
E_OUTOFMEMORY

Remarks

D3DXCreateText maps to either D3DXCreateTextA or D3DXCreateTextW, depending on the inclusion or exclusion of the #define UNICODE switch. Include or exclude the #define UNICODE switch to specify whether your application expects Unicode or ANSI strings. The following code fragment shows how D3DXCreateText is defined.

#ifdef UNICODE
#define D3DXCreateText D3DXCreateTextW
#else
#define D3DXCreateText D3DXCreateTextA
#endif

For more information on the GLYPHMETRICSFLOAT structure, see the Microsoft® Platform Software Development Kit (SDK).

Requirements

  Header: Declared in D3dx8shape.h.
  Import Library: Use D3dx8.lib.

See Also

D3DXCreateTextW