D3DX10CreateFont function

Creates a font object for a device and font.

Note

Instead of using this function, we recommend that you use DirectWrite and the DirectXTK library, SpriteFont class.

 

Syntax

HRESULT D3DX10CreateFont(
  _In_  ID3D10Device *pDevice,
  _In_  INT          Height,
  _In_  UINT         Width,
  _In_  UINT         Weight,
  _In_  UINT         MipLevels,
  _In_  BOOL         Italic,
  _In_  UINT         CharSet,
  _In_  UINT         OutputPrecision,
  _In_  UINT         Quality,
  _In_  UINT         PitchAndFamily,
  _In_  LPCTSTR      pFaceName,
  _Out_ LPD3DX10FONT *ppFont
);

Parameters

pDevice [in]

Type: ID3D10Device*

Pointer to an ID3D10Device interface, the device to be associated with the font object.

Height [in]

Type: INT

The height of the characters in logical units.

Width [in]

Type: UINT

The width of the characters in logical units.

Weight [in]

Type: UINT

Typeface weight. One example is bold.

MipLevels [in]

Type: UINT

The number of mipmap levels.

Italic [in]

Type: BOOL

True for italic font, false otherwise.

CharSet [in]

Type: UINT

The character set of the font.

OutputPrecision [in]

Type: UINT

Specifies how Windows should attempt to match the desired font sizes and characteristics with actual fonts. Use OUT_TT_ONLY_PRECIS for instance, to ensure that you always get a TrueType font.

Quality [in]

Type: UINT

Specifies how Windows should match the desired font with a real font. It applies to raster fonts only and should not affect TrueType fonts.

PitchAndFamily [in]

Type: UINT

Pitch and family index.

pFaceName [in]

Type: LPCTSTR

String containing the typeface name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the data type resolves to LPCSTR. See Remarks.

ppFont [out]

Type: LPD3DX10FONT*

Returns a pointer to an ID3DX10Font interface, representing the created font object.

Return value

Type: HRESULT

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

Remarks

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

If you want more information about font parameters, see The Logical Font.

Requirements

Header
D3DX10Core.h
Library
D3DX10.lib

See also

General Purpose Functions