ID3DXFont::PreloadText method

Loads formatted text into video memory to improve the efficiency of rendering to the device. This method supports ANSI and Unicode strings.

Syntax

HRESULT PreloadText(
  [in] LPCTSTR *pString,
  [in] INT     Count
);

Parameters

pString [in]

Type: LPCTSTR*

Pointer to a string of characters to be loaded into video memory. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR; otherwise, the data type resolves to LPCSTR. See Remarks.

Count [in]

Type: INT

Number of characters in the text string.

Return value

Type: HRESULT

If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA.

Remarks

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

This method generates textures that contain glyphs that represent the input text. The glyphs are drawn as a series of triangles.

Text will not be rendered to the device; DrawText must still be called to render the text. However, by preloading text into video memory, DrawText will use substantially fewer CPU resources.

This method internally converts characters to glyphs using the GDI function GetCharacterPlacement.

Requirements

Requirement Value
Header
D3dx9core.h
Library
D3dx9.lib

See also

ID3DXFont